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
kolezko [41]
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: pransh
Computers and Technology
1 answer:
max2010maxim [7]3 years ago
4 0

Answer:

Explanation:

The following is written in Python and does as the question requested. It asks the user for the information and adds it to the dictionary (the_dict) then it asks the user if they want to add more info and keeps adding to the_dict until the user states no. Once that happens the program places the dictionary into a tuple and prints out the results.

the_dict = {}

test_tup = ()

while True:

   key = input("Please enter a name: ")

   value = input("Please enter a number: ")

   the_dict[key] = value

   answer = input("More data (y/n)?").lower()

   if answer != 'y':

       break

test_tup = list(test_tup)

test_tup.append(the_dict)

test_tup = tuple(test_tup)

print(test_tup)

You might be interested in
Nina visited an area that receives a large amount of precipitation during all twelve months and is typically warm year round. Th
slava [35]

Answer: Rainforest

Explanation:

A rainforest is an area that typically has tall, green trees and also has a high amount of rainfall. Rainforest can be found in the wet tropical uplands and lowlands. The largest rainforests can be seen in the Amazon River Basin.

Since the area visited by Nina has a large amount of precipitation during all twelve months, typically warm year round and has a large variety of organism diversity, then the biome thatcNina most likely visited is the rainforest.

7 0
3 years ago
Identifica una necesidad que implique la reducción de los efectos perjudiciales relacionados al uso de los recursos energéticos.
ELEN [110]

Answer:

Baje las persianas o cierre las cortinas en los días calurosos, para mantener la casa fresca y reducir el uso de ventiladores eléctricos o aire acondicionado. Deje que la ropa se seque naturalmente. Mantenga las tapas en las ollas cuando cocine para ahorrar energía. Use baterias recargables.

5 0
2 years ago
Which of the following statements best describes IT careers?
DiKsa [7]

The answer is (C) IT careers are found in a wide variety of industries.

Nowadays, all types of industries in various different parts of the world will have an IT (information technology) department because it is needed, since most businesses operate using some form of IT equipment, which, most commonly found is a computer. It is a particularly lucrative field because of the wide array of job availability.

7 0
3 years ago
What programs and outher things could i use to start a youtube gameing chanel
Julli [10]
Try icthio.com I use that and its free.Good luck,!
4 0
3 years ago
What is civil construction?
sasho [114]
Civil construction is any construction in a society that belongs to the group of core infrastructure such as <span>pipelines, telecommunications, sewers, water treatment systems, highways, roads, bridges etc.</span>
6 0
3 years ago
Other questions:
  • Two electronics technicians are measuring electrical quantities in circuits. Technician A says that copper, glass, porcelain, an
    11·1 answer
  • What is the purpose of the overload keyword in the ip nat inside source list 1 pool nat_pool overload command?
    8·1 answer
  • Which hypervisor works on older pcs without hardware virtualization support?
    9·2 answers
  • Making sure that your business has something special and distinct to offer is known as?
    12·1 answer
  • PLEASE HELP
    5·1 answer
  • Businesses and sometimes individuals use a _____ to assimilate all of their social media content on a specific topic to engage r
    13·1 answer
  • 9. "मेरे तो गिरधर गोपाल, दूसरो ना कोई
    5·1 answer
  • The Curiosity Rover has recently landed on Mars and likes to send Twitter updates on its progress. If a tweet is posted 10 minut
    6·1 answer
  • What is an example of a device that commonly use Linux today
    7·2 answers
  • What is operating system​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!