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
What: A challenging question on this module's material.
Alekssandra [29.7K]

Need further information!!!

6 0
3 years ago
here are pros and cons for doing temp work. Please select the best answer from the choices provided T F
Brut [27]

Answer:

Hello! the answer should be true, I hope i got here in time.  

Explanation:

6 0
3 years ago
Read 2 more answers
What practices will help you avoid sending out e-mail to the wrong person?
wel
Check who you are sending it to before you hit send 
5 0
3 years ago
Which of the following is CORRECT about database managementsystem's languages?
scZoUnD [109]

Answer:

Data manipulation languages are used for the retrieval of the,insertion,deletion and modification of data.

Explanation:

Data Manipulation Languages(DML) are used to insert,delete,update,modify the data in the database.

The commands used to do these operations are as following:-

INSERT INTO :-This command is used to insert values in the database.

DELETE:-It is used to delete existing records from the table.

UPDATE:- It is used to modify the records in the table.

SELECT:- It is used to select data from database.

3 0
3 years ago
Which of the following code displays the area of a circle if the radius is positive? Question 4 options: if (radius <= 0) Sys
Marina CMI [18]

Answer:

(d) if (radius > 0) System.out.println(radius * radius * 3.14159);

Explanation:

Given

Code segment (a) to (d)

Required

Which is correct

Code segment (a): radius <=0

This means that radius is 0 or less, i.e. 0 or negative

Code segment (b): radius !=0

This means that radius is not equal to 0 i.e. it could be positive or negative but definitely not 0

Code segment (c): radius >=0

This means that radius is 0 or greater, i.e. 0 or positive

Code segment (d): radius >0

This means that radius is  greater than 0 i.e. positive

<em>Hence, (d) is correct</em>

3 0
3 years ago
Other questions:
  • A windows computer is shared between several users, each with his own local user account. Each user has his own dedicated, uniqu
    9·1 answer
  • Which of the following is NOT an ethical way of getting to the top of a web search?
    5·1 answer
  • Does any body like animal jam
    11·2 answers
  • Instructions:Select the correct answer.
    15·2 answers
  • On the Insert tab, select Table &gt; _______ to create a table from selected text.
    14·1 answer
  • A user is unable to install virtualization software on a Windows 8.1 computer. The user verified the host has sufficient RAM, pl
    6·1 answer
  • Adam is an Engineering student but has decided that he does not want to work in that field, but in the Manufacturing career clus
    11·2 answers
  • Es la actividad que posibilita comunicar gráficamente ideas, hechos y valores procesados y sintetizados en términos de forma y c
    11·1 answer
  • Please help I will mark brainliest ⚡️⚡️⚡️⚡️
    12·1 answer
  • Cho lược đồ CSDL “Quản lý BÁN HÀNG” có các bảng như bên dưới. (Thuộc tính in đậm và
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!