Q. Write a Python program to input names of 'n' customers and their details like items bought, cost and phone number, etc., store them in a dictionary and display all the details in a tabular form.
Answer =
dic = {} while True : nam = input("Enter name :- ") phone = float(input("Enter phone number :- ")) cost = float(input("Enter cost :- ")) item = input("Enter item :- ") dic[ nam ] = [ phone , item , cost ] a = input("Do you want to enter more records enter (Yes/ No) :- ") if a == "No" or a == "no": break for i in dic : print() print("Name : ", i ) print("Phone : ", dic[ i ][ 0 ] , "\t", "Cost : ", dic[ i ][ 1 ] , "\t", "Item : ", dic[ i ][ 2 ])
Output :-
Enter name :- Path
Enter phone number :- 123456789
Enter cost :- 89
Enter item :- Computer
Do you want to enter more records enter (Yes/ No) :- yes
Enter name :- Walla
Enter phone number :- 987654321
Enter cost :- 99.8
Enter item :- Laptop
Do you want to enter more records enter (Yes/ No) :- yes
Enter name :- Portal
Enter phone number :- 567894321
Enter cost :- 75
Enter item :- CPU
Do you want to enter more records enter (Yes/ No) :- yes
Enter name :- Express
Enter phone number :- 123498765
Enter cost :- 150
Enter item :- Mouse
Do you want to enter more records enter (Yes/ No) :- No
Name : Path
Phone : 123456789.0 Cost : Computer Item : 89.0
Name : Walla
Phone : 987654321.0 Cost : Laptop Item : 99.8
Name : Portal
Phone : 567894321.0 Cost : CPU Item : 75.0
Name : Express
Phone : 123498765.0 Cost : Mouse Item : 150.0
>>>
output
ReplyDeleteOk.
Deletehow to change the POINT in number??
ReplyDeletePOINTS means ???
Deletecost and item are interchanged
ReplyDeletecost is given as computer and item is given as 89
please make it proper
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )