Extra Exercises

  1. What is the result of each of the following:

    1. ‘Python’[1]
    2. “Strings are sequences of characters.”[5]
    3. len(“wonderful”)
    4. ‘Mystery’[:4]
    5. ‘p’ in ‘Pineapple’
    6. ‘apple’ in ‘Pineapple’
    7. ‘pear’ not in ‘Pineapple’
    8. ‘apple’ > ‘pineapple’
    9. ‘pineapple’ < ‘Peach’
    1. ‘Python’[1] evaluates to ‘y’
    2. ‘Strings are sequences of characters.’[5] evaluates to ‘g’
    3. len(‘wonderful’) evaluates to 9
    4. ‘Mystery’[:4] evaluates to ‘Myst’
    5. ‘p’ in ‘Pineapple’ evaluates to True
    6. ‘apple’ in ‘Pineapple’ evaluates to True
    7. ‘pear’ not in ‘Pineapple’ evaluates to True
    8. ‘apple’ > ‘pineapple’ evaluates to False
    9. ‘pineapple’ < ‘Peach’ evaluates to False
  2. Write code that asks the user to type something and deletes all occurrences of the word “like”.

  3. Write code that asks the user to type something and removes all the vowels from it, then prints it out.

  4. Write code that transforms the list [3, 6, 9] into the list [3, 0, 9] and then prints it out

Next Section - Introduction: Iteration