write a program to create dictionary which accept and store names of product and their prices
Answers
Answered by
2
Answer:
Dictionary is the most important data structure of Python. Like lists and tuples, a dictionary is a collection of items, where each item is in the form of a key-value pair.
Let's take an example to explain it.
Suppose, the cost of a mango is 40
The cost of a banana is 10
The cost of cherry is 20
To store them, we can use a list or a tuple, but using a dictionary is another good way to store all these in a better way.
Answered by
0
Answer:
state_capital={}
num=int(input("Enter the number of states and capitals:"))
for i in range (num):
state=input("Enter the state:")
capital=input("Enter the capital:")
state_capital[state]=capital
print("the created stat eand capital dictionary is:",state_capital)
Similar questions