मराठी

Write a program to input n customer name and phone numbers.

Advertisements
Advertisements

प्रश्न

Write a program to input n customer name and phone numbers.

कोड लेखन
Advertisements

उत्तर

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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1: Review of Phython - EXERCISE [पृष्ठ २७]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
पाठ 1 Review of Phython
EXERCISE | Q 29. | पृष्ठ २७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×