from time import sleep
emergency = "911"
phone = {"Mother":"xxx-xxx-xxxx", "Father":"xxx-xxx-xxxx", "911":emergency,
"Police":emergency, "Fire":emergency, "Emergency":emergency}
emails = {"Mother":"xxxxxx@gmail.com", "Father":"xxxxxx@gmail.com", "911":emergency, "Police":emergency, "Fire":emergency, "Emergency":emergency}
while True:
email_numb = input("Do you want Email or Phone numbers? (Type one, Phone or Email) For more options type m: ").lower().capitalize()
if email_numb == "Email":
email_input = input("Who's email would you like to find? (enter a name): ").lower().capitalize()
if email_input in emails:
print(emails[email_input])
else:
print("Sorry but I cannot find the name, check out for typos")
sleep(2)
elif email_numb == "Phone":
phone_input = input("Who's phone number would you like to find? (enter a name): ").lower().capitalize()
if phone_input in phone:
print(phone[phone_input])
else:
print("Sorry but I cannot find the name, check for typos")
sleep(2)
elif email_numb == "M":
what_to_do = input("Do want to edit, add, or delete, a person in the directory? (Type add, edit, or delete) ").lower().capitalize()
if what_to_do == "Add":
email_number = input("Would you like to add a new email address or a new phone number? (type email or phone) ").lower().capitalize()
if email_number == "Email":
name = input("Please type the name: ")
email = input("Please type the email: ")
print(f"{name}, {email}")
emails.update({name:email})
print("Added succesfully!")
continue
elif email_numb == "Q":
break
elif email_numb != {'Email', 'Phone', "M"} :
print("Sorry, I don't understand")
sleep(2)
continue
stop_or_continue = input("Would you like to search up another number/email address? Press q to quit and any other key to continue: ")
if stop_or_continue == "q":
break
else:
continue
I type "m", then "add", I put in the name, then the email, (I only programmed that so far, I didn't do phone numbers yet), it doesn't give me errors, but it doesn't add the name or email to the dictionary. I know I should organize the code, but does anyone know why it doesn't work?