Question
you will be practicing your new skills with Python dictionaries. For this project, you will be creating a new directory, so please follow the below
you will be practicing your new skills with Python dictionaries. For this project, you will be creating a new directory, so please follow the below setup instructions.
Setup
First, open up your command prompt/terminal
Within your command prompt/terminal, run the following command:
cd desktop
Next, run the following:
cd python_course
Run the following to create a new directory for this project:
mkdir lesson_four_handson
Open up a new window in VSCode.
Click on the "Explorer" button on the left-hand side of the VSCode window.
Click the Open Folder button.
Select the lesson_four_handson directory within the python_course folder on your Desktop. Click the Open button.
Create a new file named main.py by one of the following three ways:
To the right of LESSON_FOUR_HANDSON in the EXPLORER is a button that looks like a piece of paper with a plus symbol in its top-left corner. If you hover your mouse over this button for a moment, a popup will appear indicating that this button will create a new file.
Choose File > New File from the app's menu.
Press Control + N in Windows or Command + N on a Mac (the plus means "and at the same time").
Now you are ready to get started on your Lesson 4 Hands-On!
Requirements
This hands-on is broken into three parts. Please complete each part within your main.py file.
Part 1
Create two dictionaries to represent information about two pets. Each dictionary should contain the following information (different for each pet):
Pet's Name (This should be the name of your dictionary)
Type of Pet
Color
Nickname
Owner's Name
Iterate over each dictionary, printing each key-value pair on one line. The output should be similar to the below:
Type: Cat Color: White and Orange Nickname: Birchy Owner: Kurt Type: Cat Color: Tortoise Shell Nickname: Palnut Owner: Olivia
Part 2
Add three new dictionaries to your program.
Each dictionary should represent a city around the world.
Add the below dictionaries to your main.py file:
england = {'Capital': 'London'} france = {'Capital': 'Paris'} belgium = {'Capital': 'Brussels'}
Given the above dictionaries, add the following information to each dictionary:Population
The population of England is 53.01 million
The population of France is 66.9 million
The population of Belgium is 11.35 million
Interesting Fact
Top Language Spoken by Locals
Once you have added the necessary information into the dictionaries, loop through each one and print out all key-value pairs.
Part 3
Add a dictionary to your program that replicates a user's pizza order. Name this dictionary pizza_order and it should contain the following:
Customer's Name
What size pizza they have ordered
What type of crust
What toppings they would like.
Toppings should include at least three separate toppings
Next, print out the customer's order:
Thank them for their order using their name
Print out what they're ordering
Print out the list of toppings (minimum 3)
Your output should looks similar to the following:
Thank you for your order, Andrew You have ordered a small, thin-crust pizza with the following toppings: extra cheese, sausage, bacon
Use the print() and get() functions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started