08 Checkpoint: Dictionaries
Purpose
Improve your ability to use dictionaries in a Python program.
Helpful Documentation
- The prepare content for the previous lesson explains how to retrieve an element from a list.
- The preparation content for this lesson explains how to find items in a dictionary.
Assignment
Write a program that stores information about vehicles in a Python dictionary. Your program must ask a user to enter a vehicle identification number (VIN), then find that VIN in the dictionary, and print the manufacturer, model, and color of the vehicle. Do the following:
- Download and save the vehicles.py Python file and then open it in VS Code.
- Using VS Code, read the comments in the program. Then replace all three occurrences of the keyword
pass
with code that does what the comments describe. - Run your program and verify that it works correctly.
Testing Procedure
Verify that your program works correctly by following each step in this testing procedure:
- Run your program and enter the inputs shown below. Ensure that your program’s output matches the output below.
> python vehicles.py Please enter a VIN: QT71603 QT71603 is not in the dictionary. > python vehicles.py Please enter a VIN: 5TDZA23CXTU102983 Toyota Sienna gold
Sample Solution
When your program is finished, view the sample solution for this assignment to compare your solution to that one. Before looking at the sample solution, you should work to complete this checkpoint program. However, if you have worked on it for at least an hour and are still having problems, feel free to use the sample solution to help you finish your program.
Submission
When complete, report your progress in the associated I‑Learn quiz.