Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: Exercise 1: Nested Dictionaries Create a new function called AddNewFullContact Add a parameter that will be a dictionary that we will store a collection

Python:

Exercise 1: Nested Dictionaries

  • Create a new function called AddNewFullContact
    • Add a parameter that will be a dictionary that we will store a collection of contacts with their associated contact info
    • Ask the user for the following information:
      • name - "Please enter the name of your friend: "
      • number - "What is your friend's 7-digit phone number? ", "That's not 7 digits, try again: "
      • email - "What is your friend's email address? "
      • age (between 0 and 125, inclusive) - "What is your friend's age? ", "That's not a real age, try again: "
    • Store the "number", "email", and "age" (be sure to use exactly those words) into a new dictionary (not the function's parameter!) that will represent name's contact info
    • Store the entire dictionary into the contacts dictionary using name as its key
  • Using a loop, add 5 contacts to the dictionary using AddNewFullContact
  • Pretty print the dictionary
  • Print all of the names in the dictionary (hint: keys)
  • Print all of the full contact info in the dictionary (hint: values)
  • Ask the user for the name they want to look up, "Whose number do you want? "
  • Pretty print this contact's full contact info
  • Print out just the email associated with that name

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Discuss the alternative types of health care plans.

Answered: 1 week ago

Question

Explain the service recovery paradox.

Answered: 1 week ago