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

  1. Can a list be an element of a list?
  2. What do you call a list each of whose elements is a list?
    a two-dimensional list
  3. What is a tuple?
    a sequence that cannot be changed
  4. Write a Python statement that creates a tuple assigned to the variable numbers containing the integers 1 through 5.
    numbers = (1, 2, 3, 4, 5)
  5. Write a Python statement that creates an empty tuple assigned to the variable empty.
    empty = ()
  6. Write a Python statement creates a tuple containing only the integer one an assigns it to the variable t_1.
    t_1 = (1,)
  7. Does does a tuple have an append method?
  8. Can you concatenate two tuples?
  9. Does a tuple have a sort method?
  10. Write the function print_2_d_list that prints out a two dimensional list with each inner list appearing on a single line.
    def print_2_d_list(list):
    for row in range(len(list)):
        row_string = ""
        for column in range(len(list[row])):
            row_string += str(list[row][column]) + " "