CSC 171 - Introduction to Computer Programming
Lab Assignment #9 - Basic Work with Strings
Due Friday, October 13, 2023
From our work with strings so far, we have seen that we can compare strings
using the same relational operators as we have used before: >, >=, ==,
!=, <, <=
- Use your computer and Python to confirm which string in each pair come
first:
- 'Samuel' and 'samuel'
- 'John' and 'Jack'
- 'Isaiah' and 'Isiah'
- 'Applecart' and 'Apple Cart'
- 'Python' and 'python'
We also saw that we can work with slices of strings:
- S = 'This is a string'
- S[3:6] will be "s is"
- Use your computer and Python to determine what these string slices are:
phrase = "This is the time for all good men and women to come to aid of
their country"
- phrase[3:14]
- phrase[ :7]
- phrase[10:21]
- phrase[30:]
- phrase[11:31:3]
Submit the python code that you wrote to test this as well as your output.
No pseudocode or flowchart is required on THIS assignment.
[Back to the Lab Assignment List]