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
Vika [28.1K]
3 years ago
8

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 Number: 517-842-5425 More data (y/n)? y Name: alireza Number: 517-432-5224 More data (y/n)? n [('alireza', '517-432-5224'), ('pranshu', '517-244-2426'), ('rich', '517-842-5425')]
Computers and Technology
1 answer:
babymother [125]3 years ago
5 0

Answer:

Okay. I am doing it with Python. Hope it'll help you to understand the concept.

Code:

the_dict={}   #Creating a dictonary

def dat():    # Creating a function named dat()

   

   name = input('Your Name: ')   # Data from user

   ph = input('Phone Number: ')

   for i in range(1):  #Creating loop

       the_dict[name]=ph   # Placing the value in dictonary

   more = input('More Data (y/n): ')   # Asking for More data

   if more == 'y':   # if more is y then run the function dat()

       dat()   # calling dat()

   elif more == 'n':   # if more is n then print the dictonary named 'the_dict'

       print(the_dict)

   else:

       print('Wrong Input')  # if wrong input print the message and run dat() again

       dat()

dat()  # calling the function

   

Result:

Your Name: PyMan

Phone Number: 9814579063

More Data (y/n): y

Your Name: PyMman2

Phone Number: 451513262026

More Data (y/n): y

Your Name: C#Man

Phone Number: 7798822222

More Data (y/n): n

{'PyMan': '9814579063', 'PyMman2': '451513262026', 'C#Man': '7798822222'}

You might be interested in
Which graphic file format is used for commercial purposes.
bazaltina [42]

Answer:

jpg or png

Explanation:

hope this helps

8 0
3 years ago
A cell's address, its position in the workbook, is referred to as a ________________ when it is used in a formula.
Inga [223]

Answer:

A cell's address, its position in the workbook, is referred to as a <u>cell reference</u>  when it is used in a formula.

5 0
3 years ago
Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
rewona [7]

Answer:

Program for the above question in python:

mass = float(input("Enter the mass in grams")) # It is used to take the mass as input.  

density = float(input("Enter the density grams per cm cube")) # It is used to take the input for the grams.

print("Volume ={:.2f}".format(mass/density)) #It is used to print the Volume.

Output:

  • If the user inputs as 2.98 and 3.2, then it will results as 0.92.

Explanation:

  • The above code is in python language, in which the first statement is used to take the inputs from the user for the mass and sore it into a mass variable.
  • Then the second statement also takes the input from the user and store it into a density variable.
  • Then the third statement of the code is used to print the volume up to two places using the above-defined formula.
3 0
4 years ago
Presentation aids should include short phrases or images to convey your message.
pantera1 [17]
Hi!

The answer is True because a typical audience does not have a large attention span so using short phrases and images is the best way to get your message across to them.
5 0
3 years ago
What color is the highway sign that indicates restaurant?
Rina8888 [55]
Its perhaps blue colour .
Hope this helps !!

5 0
3 years ago
Other questions:
  • Which of the following would you click to access Help and Support?
    6·2 answers
  • Which of the following is a typical concern for developers while using prototypes?
    6·2 answers
  • The R1 shell opens in a terminal window with black text and white background. What user is logged into
    8·1 answer
  • Graphic design has as its goal the communication of some __________ message to a group of people.
    6·1 answer
  • Which function in the plane manager allows you to create a new plane where both x and y axes are perpendicular to the line selec
    14·1 answer
  • Does any body know how to bypass easy anti cheat on crossout
    7·1 answer
  • Public class Dog
    7·1 answer
  • What types of character Microsoft Excel understand​
    6·1 answer
  • A program that performs handy tasks, such as computer management functions or diagnostics is often called a/an ____________.
    8·1 answer
  • What is the accurate description
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!