Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contacts = {}
- count = None
- while True:
- info = input()
- if info.isdigit():
- count = int(info)
- break
- if info == 'search':
- break
- name, number = info.split('-')
- if name and number:
- contacts[name] = number
- if count:
- for x in range(count):
- contact = input()
- if contact in contacts:
- print(f'{contact} -> {contacts[contact]}')
- else:
- print(f'Contact {contact} does not exist.')
- else:
- while True:
- info = input()
- if info == 'stop':
- break
- name = info
- if name in contacts:
- print(f'{name} -> {contacts[name]}')
- else:
- print(f'Contact {name} does not exist.')
Advertisement
Add Comment
Please, Sign In to add comment