In: Computer Science
write a progam in python that willl take user input for item and price and save them in a dictionary.
Then print the item and price and the total price.
d=dict()
for i in range(3):#reads 3 items and prices and stores them in
dictionary
item=input("Enter item name:")
p=int(input("Enter item price:"))
d[item]=p
print("Item","Price",sep="\t")#print the dictionary data
print("--------------------")
for k,v in d.items():
print(k,v,sep="\t")
print("The total price is :",sum(list(d.values())))#get the values
from list and compute sum and print it
Screenshots:
The screenshots are attached below for reference.
Please follow them for output and proper indentation.