forked from taylo403/121COM-Retake-Assignment
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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() |