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: >, >=, ==, !=, <, <=

  1. Use your computer and Python to confirm which string in each pair come first:
    1. 'Samuel' and 'samuel'
    2. 'John' and 'Jack'
    3. 'Isaiah' and 'Isiah'
    4. 'Applecart' and 'Apple Cart'
    5. 'Python' and 'python'

    We also saw that we can work with slices of strings:

  2. 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"
    1. phrase[3:14]
    2. phrase[ :7]
    3. phrase[10:21]
    4. phrase[30:]
    5. 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]