Skip to content
Permalink
8df4466ac9
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (44 sloc) 1.32 KB
phonebook ={}
def print_menu():
print('1. Phone Numbers')
print('2. Add Phone Number')
print('3. Wipe Phone Number')
print('4. Find Phone Number')
print('5. Exit')
print()
def show_phonebook(search):
global phonebook
print(phonebook[search])
show_phonebook()
'''show_phonebook()'''
print("# Showing the phonebook")
if __name__== "__main__":
# Create some entries then show the phonebook
print("# Creating some entries...")
add_entry('myles123456789','myles@outlook.com','Coventry, CV1 4VB')
numbers ={}
menu_choice = 0
print_menu()
while menu_choice != 5:
menu_choice = int(input("Type in a number (1-5): "))
if menu_choice == 1:
print("Phone Numbers:")
elif menu_choice == 2:
print("Add Name and Number")
name = input("Name: ")
phone = input("Number: ")
print("Wipe Phone Number")
name = input("Name: ")
if name in numbers:
del numbers[name]
else:
print(name, "was not found")
elif menu_choice == 4:
print("Find Phone Number")
name = input("Name: ")
if name in numbers:
print("The number is", numbers[name])
else:
print(name, "not found")
elif menu_choice != 5:
print_menu()