I'm stuck on this code I'm trying to complete. I want it to print there's no more recipes left but it prints lets choose a different meal twice.
my_choice = ["a","b","c"]
bank = {"recipe1":[["a","b","c"], "d", "e", "f"],
"recipe2":[["a","b","c"], "g", "h", "i"],
"recipe3":[["a","b","c"], "j", "k", "l"],
"recipe4":["x", "y", "z"]}
for k,v in bank.items():
if my_choice in v:
print(f"Your meal we have chosen for you is {k,v}")
print("Do you like your meal? y/n"
choice = input()
if choice == "y"
print("Enjoy your meal!")
break
elif choice == "n"
print("Lets find you a different meal") # this prints out twice when the alternate recipes run out.
else:
print("Please select y or n to keep your meal or select a different recipe.")
print(f"Your meal we have chosen for you is {k,v}")
print("Do you like your meal? y/n"
choice = input()
if len(my_choice) in food_bank.items() > len(v):
print("Sorry we have no more recipes")
Aucun commentaire:
Enregistrer un commentaire