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
President Roosevelt's Fireside Chats were:
larisa86 [58]
C. Entertaining radio shows that families listened to in the evening. He did these chats to inform the public on what he was going to do about the problems facing the public.
3 0
3 years ago
Read 2 more answers
which of the following peripheral does not belong to a group: A) Monitor B) Printer C) Hardware D) Keyboard​
nikdorinn [45]
C hardware is the correct answer
5 0
3 years ago
"the most common way to access the internet is through ________."
liubo4ka [24]
The most common was is your phone
6 0
3 years ago
If a system's instruction set consists of an 8-bit opcode, what is the maximum number of output signal lines required for the co
otez555 [7]

Answer:

D. 256

Explanation:

Given

Instructions = 8\ bit

Required

Determine the maximum number of output

To get the required value, we make use of the following:

Maximum = 2^n

Where n is the bits of the opcode.

i.e.

n = 8

Substitute 8 for n in Maximum = 2^n

Maximum = 2^8

Maximum = 256

<em>Hence, option D answers the question</em>

6 0
3 years ago
A computer has three main modules that have individual reliabilities of 0.77, 0.94, and 0.81. Because of recent failures, manage
Artemon [7]
Yo también necesito ayuda con esto:(
6 0
3 years ago
Other questions:
  • What is the difference between First Person Shooters and Construction Simulations?
    12·2 answers
  • What is created for each user the first time the user logs onto windows?
    7·1 answer
  • An excel user should use a relative cell reference when it is important to ____. preserve the relationship to the formula locati
    7·1 answer
  • Soo...My Old 3DS XL haven't been touched in around a year...So i tried to charge it but no LED lights opened..Even the power but
    14·1 answer
  • Even though a high-level programming language
    11·1 answer
  • A server provides the necessary IP configuration to your network host so the host can communicate on the network. If this servic
    7·1 answer
  • Jenny is the project manager and her company. She needs to break her current project into parts that her employees can work on.
    10·1 answer
  • Information flows:
    11·1 answer
  • A benefit of flashcards is that they are
    7·2 answers
  • Which of the following best describes
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!