1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natta225 [31]
3 years ago
9

Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_di

ct') as key-value pair. The program then asks if the user wants to enter more data (More data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list. Note: Ignore the case where the name is already in the dictionary. Example: Name: pranshu Number: 517-244-2426 More data (y/n)? y Name: rich
Computers and Technology
1 answer:
AleksAgata [21]3 years ago
6 0

Answer:

#Declare the variables.

the_dict = {}

dictlist = []

#Begin the while loop.

while True:

   #Prompt the user to enter the name

   #and the number.

   input_name = input("Name: ")

   input_number = input("Number: ")

   

   #Ask the user to continue or stop

   #the program.

   input_choice = input('More data (y/n)? ')

   the_dict[input_name] = input_number

   

   #Check the input.

   if input_choice == 'n':

       break

#If the user want to continue

#then append in the list.

for key, value in the_dict.items():

   

   #Store the values in dictionary.

   temp_val = (key,value)

   dictlist.append(temp_val)

   

#Sort the list.

print(sorted(dictlist))

You might be interested in
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appe
aleksandrvk [35]
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appearance.

affecting computing techniques
8 0
3 years ago
I am trying to code a lifting simulator game on ro-blox. These problems listed in the third picture tells you the problems. If y
Andru [333]
I have no idea but keep grinding
7 0
3 years ago
Courts are struggling with the privacy implications of GPStracking. In 2009, New York’s highest court held that policeofficers m
aniked [119]

Answer:

warrant

Explanation:

New York State's highest court ruled in 2009 that tracking a person via the global positioning system (GPS) without a warrant violated his right to privacy.

6 0
4 years ago
A(n) _____ evaluates a specified data set and returns certain fields from that data set as instructed.
elena55 [62]

The correct answer is Query

5 0
3 years ago
Read 2 more answers
Cloud computing will offer applications that are _______.
Komok [63]
B. only accesible over the internet
8 0
4 years ago
Read 2 more answers
Other questions:
  • What does limited access to a document mean?
    14·2 answers
  • The first time you save a document, which screen appears
    8·2 answers
  • Describe an application where a parallel circuit might work better than a series circuit.
    15·1 answer
  • Plz help ASAP
    10·1 answer
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • no one can succeed in his or her career without relying on others for help or opportunities. It’s best, though,
    13·1 answer
  • Which types of computers are used by large businesses
    10·1 answer
  • Which of the following is one of the options available on the Columns menu on the
    6·1 answer
  • Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of
    8·1 answer
  • Convert alzebric expression into basic expression<br> (1/2)bh<br> PLEASE GIVE ANSWER FAST
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!