Objective
Create a Python program that manages a contact book stored in a dictionary (name → phone). It is the first mini-project: organise the code in functions and a main loop that reads commands.
Instructions
- Read an integer
nand thenncommands, one per line. Names and phone numbers contain no spaces. add NAME PHONE: stores the contact. ShowAdded: NAMEif it is new orUpdated: NAMEif it already existed (the phone is replaced).find NAME: showNAME: PHONE, orNot found: NAMEif it does not exist.delete NAME: remove the contact and showDeleted: NAME, orNot found: NAMEif it does not exist.list: show oneNAME: PHONEline per contact, sorted by name, orEmpty contact bookif the book is empty.- At the end, show
Contacts: Kwith the number of contacts left.
5
add Ana 600111222
add Luis 600333444
find Ana
delete Luis
list
Added: Ana
Added: Luis
Ana: 600111222
Deleted: Luis
Ana: 600111222
Contacts: 1
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise