# simplified example
# [ ] review the code then run and following the flowchart paths
# ***TIP:*** click in input box before typing
sandwich_type = input('"c" for Cheese or "v" for Veggie Special: ')
if sandwich_type.lower() == "c":
# select cheese type
cheese_type = input('"c" for Cheddar or "m" for Manchego: ')
if cheese_type.lower() == "c":
print("Here is your Cheddar Cheese sandwich")
else:
print("Here is your Manchego Cheese sandwich")
else:
print("Here is your Veggie Special")
Here is your Manchego Cheese sandwich
# full example: handling some invalid input and elif statement
# [ ] review the code then run following the flowchart paths including **invalid responses** like "xyz123"
# ***TIP:*** click in input box before typing
print("Hi, welcome to the sandwich shop. Please select a sandwich.")
sandwich_type = input('"c" for Cheese or "v" for Veggie Special: ')
# select sandwich type sandwich_type = input('"c" for Cheese or "v" for Veggie Special: ')
print()
if sandwich_type.lower() == "c":
# select cheese type
print("Please select a cheese.")
cheese_type = input('"c" for Cheddar or "m" for Manchego: ')
print()
if cheese_type.lower() == "c":
print("Here is your Cheddar Cheese sandwich. Thank you.")
elif cheese_type.lower() == "m":
print("Here is your Manchego Cheese sandwich. Thank you.")
else:
print("Sorry, we don't have", cheese_type, "choice today.")
elif sandwich_type.lower() == "v":
print("Here is your Veggie Special. Thank you.")
else:
print("Sorry, we don't have", sandwich_type, "choice today.")
print()
print("Goodbye!")
Hi, welcome to the sandwich shop. Please select a sandwich.
Sorry, we don't have choice today.
Goodbye!
user = input (" (Y/N)Say: 'Hello' ? ").lower()
if user == "n":
print ("Friendly Nod")
elif user == "y":
input ("Full 'Hello' ? ")
if input == "y":
print ("Hi")
else:
print("Hello")
bird_names="robin", "eagle", "vulture", "crow"
bird_guess=input("Name a bird I like:")
if bird_guess not in bird_names:
print("Nope, try again!!!")
bird_guess=input("Name a bird I like:")
if bird_guess not in bird_names:
print("Nope, try again!!!")
bird_guess=input("Name a bird I like:")
if bird_guess not in bird_names:
print("Nope, try again!!!")
else:
print("Look at the big brain on you!!!")
else:
print("Look at the big brain on you!!!")
else:
print("Look at the big brain on you!!!")
Nope, try again!!!
Execution error
KeyboardInterrupt: Interrupted by user