Advertisements
Advertisements
Question
Write a program to input n customer name and phone numbers.
Code Writing
Advertisements
Solution
Use a dictionary to store customer name as the key and phone number as the value.
n = int(input("Enter number of customers: "))
customers = {}
for i in range(n):
name = input("Enter customer name: ")
phone_number = input("Enter phone number: ")
customers[name] = phone_number
print(customers)
shaalaa.com
Is there an error in this question or solution?
