IT 116: Introduction to Scripting
Answers to Class 26 Ungraded Quiz

  1. Are strings sequences?
    yes
  2. What are the elements of a string?
    characters
  3. Write a Python expression that returns the FIRST character in the string team.
    team[0]
  4. Write a Python expression that returns the LAST character in the string team.
    team[len(team) - 1]
  5. Can you use a negative number as an index to a string?
    yes
  6. If the string variable team is assigned the value "Red Sox", what does the following expression return?
    team[-1]
    x
  7. Can a string be changed?
    no, strings are immutable
  8. Write a Python expression that returns a string consisting of the FIRST 3 characters in the string team.
    team[0:3] or team[:3]
  9. Write a Python expression that returns a string consisting of the LAST 3 characters in the string team.
    team[-3:]
  10. Write a loop to print the individual characters of a the string team with each character appearing on a separate line.
    for i in range(len(team)):
    	print(team[i])