IT 117: Intermediate to Scripting
Answers to Class 7 Ungraded Quiz

  1. Can the key in a dictionary entry be any data type?
    no. you can only use values that are immutable, that cannot be changed
  2. Can the value in a dictionary entry be any data type?
    yes
  3. Can the value in a dictionary entry be a list?
    yes. values do not have to be immutable
  4. What string value does Python think of as False in an if statement?
    the empty string
  5. What string value does Python think of as True in an if statement?
    anything that is not the empty string
  6. What integer value does Python think of as True in an if statement?
    anything other than 0
  7. What integer value does Python think of as False in an if statement?
    only 0
  8. What boolean value does Python assign to -1 in an if statement?
    True
  9. What does the clear method of a dictionary object do?
    removes all the key-value pairs from a dictionary
  10. What does the get method of a dictionary object do?
    it retrieves a value from a dictionary, but does not raise an exception if the key given as an argument 
    does not exist in the dictionary