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

  1. Write a Python expression that returns a slice containing the second through the fourth elements of the list list_1.
    list[1:4]
  2. Write a Python expression that evaluates to True if the list list_1 contains the value 4.
    4 in list_1
  3. Write a Python statement to add 6 to the list list_1.
    list_1.append(6)
  4. Write a Python expression that gives the value of the index, in the list list_1, of the element whose value is 3.
    list_1.index(3)
  5. Write a Python statement that adds the value 0 to the list list_1 at the first position in the list.
    list_1.insert(0,0)
  6. Write a Python statement that removes the first element in the list list_1.
    list_1.remove(0)
  7. Write a Python statement that sorts the list list_1.
    list_1.sort()
  8. Write a Python statement that sorts the list list_1 in reverse order.
    list_1.reverse()
  9. Write a Python expression that gives the largest value in the list list_1.
    max(list_1)
  10. Write a Python expression that gives the smallest value in the list list_1.
    min(list_1)