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

  1. What comes after the keyword in in a Python for loop?
    a list of values
  2. What is the name of the Python function used to create a list of numbers in a for loop?
    range
  3. If the function mentioned above were run with the single argument 5, what is the list of numbers that would be created?
    0, 1, 2, 3, 4
  4. If the function mentioned above were run with the two arguments 1 and 5, what is the list of numbers that would be created?
    1, 2, 3, 4
  5. If the function mentioned above were run with the three arguments 1, 10 and 2, what is the list of numbers that would be created?
    1, 3, 5, 7, 9
  6. If the function above is run with only one argument, what does that argument specify?
    one more than the last number in the list
  7. If the function above is run with two arguments, what does the first of the two arguments specify?
    the first number in the list
  8. If the function above is run with three arguments, what does the third of the three arguments specify?
    the difference between each number in the list
  9. Write a for loop that prints the values from 1 to 10, each on a separate line.
    for number in range(10):
    	print(number + 1)
  10. Write a for loop that prints the values from 10 to 1, each on a separate line.
    for number in range(10, 0, -1):
    	print(number)