IT 117: Intermediate Scripting
Class 6 Ungraded Quiz


  1. Write the Python statement to create an empty dictionary named students.


  2. What is the length of an empty dictionary?


  3. Write the Python statement to create an entry in the students dictionary for a student with student ID '0123456' whose name is 'John Smith'.


  4. Write the Python expression you would use to test whether the students dictionary contains an entry for a student with the ID '0123456'.


  5. Write the Python expression you would use to test whether the students dictionary does not contain an entry for a student with the ID '0123456'.


  6. Write the Python statement you would use to delete the entry in the students dictionary with key value '0123456'.


  7. What would happen if you tried to delete a dictionary entry using a key that was not in the dictionary?


  8. What does the length of a dictionary mean?


  9. Write the Python expression you would use to get the length of the dictionary students.


  10. Can dictionary entries be accessed by their position?