-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.py
More file actions
24 lines (21 loc) · 731 Bytes
/
contact.py
File metadata and controls
24 lines (21 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
contacts = {}
running = True;
while running:
command = input('enter A(dd) D(elete) F(ind) Q(uit)')
if command == 'A' or command == 'a':
name = input('enter a new name');
print('enter a phone number for', name, end=':')
number=input()
contacts[name] = number
elif command == 'D' or command == 'd':
name = input('enter name to delete')
del contacts[name]
elif command == 'F' or command == 'f':
name = input('enter a name to search for')
print(name,contacts[name],sep=':')
elif command == 'Q' or command == 'q':
running = False
elif command == 'list':
print(contacts)
else:
print(command, 'is not a valid command')