A python question ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A python question ???

Does any body know how to write a phone book in python language? without database!!!

26th Oct 2018, 4:05 PM
Alireza Lahijanian
Alireza Lahijanian - avatar
2 Answers
0
thanks for your attention
26th Oct 2018, 4:05 PM
Alireza Lahijanian
Alireza Lahijanian - avatar
0
You can use a dictionary. Name would be key, number value. phonebook = {'Mike': '12345', 'Wendy': '54321', ... } Then you can access the numbers by name, for example: print(phonebook('Wendy'))
26th Oct 2018, 8:41 PM
HonFu
HonFu - avatar