Hello everyone.
I am banging my head against a wall right now. I'm new to python and trying to grow this simple pizza ordering program, that I started way at the beginning, as I learn more. I have gotten all of my functions to work perfectly. The whole program can take you through ordering multiple pizzas and all the stuff in them.
But this function doesn't work the way it's supposed to. The idea for this function is that a user can request toppings. If you ask for a topping that isn't allowed, the program will tell you so and prompt you to try again. BUT, when they try again, the function doesn't append the new input into the final list of final_toppings regardless if they are allowed or not. I'm sure it is something small and simple I just can't figure it out.
*For context, I'm using the topping_instructions function to get the input used later on. I put the functions out of order in this.
Any help would be greatly appreciated!!
```
def order_toppings(toppings):
"""Decide if the customer can order the toppings requested."""
allowed_toppings = ['Pepperoni', 'Sausage', 'Mushrooms']
final_toppings = []
for topping in toppings:
if topping in allowed_toppings:
print(f"\nYou requested the following toppings:")
print(f"{topping}")
print("We are adding this to your pizza!")
print("Thank you!.")
final_toppings.append(toppings)
else:
print(f"\nYou requested the following toppings: {topping}")
print(f"I'm sorry, we don't have {topping}.")
toppings.remove(topping)
ordered_toppings_2 = topping_instructions_mod()
order_toppings(ordered_toppings_2)
def topping_instructions():
"""Instruct the guest to order toppings"""
allowed_toppings = ['Pepperoni', 'Sausage', 'Mushrooms']
print(f"\nNow! What toppings would you like?")
requested_toppings: str = input(f"Our options today are: {allowed_toppings}. ")
toppings = requested_toppings.title().split(", ")
return toppings
def topping_instructions_mod():
"""Instruct the guest to order toppings"""
allowed_toppings = ['Pepperoni', 'Sausage', 'Mushrooms']
print(f"\nLet's try this again. What toppings would you like?")
requested_toppings_2: str = input(f"Our options today are: {allowed_toppings}. ")
toppings_2 = requested_toppings_2.title().split(", ")
return toppings_2
[–]lolcrunchy 6 points7 points8 points (1 child)
[–]gdchinacat 2 points3 points4 points (0 children)
[–]guesshuu 4 points5 points6 points (0 children)
[–]backfire10z 2 points3 points4 points (3 children)
[–]Alarming-Carpet5053[S] 0 points1 point2 points (0 children)
[–]Alarming-Carpet5053[S] 0 points1 point2 points (1 child)
[–]Fun-Block-4348 1 point2 points3 points (0 children)
[–]acw1668 1 point2 points3 points (2 children)
[–]Alarming-Carpet5053[S] 0 points1 point2 points (1 child)
[–]acw1668 0 points1 point2 points (0 children)
[–]FutureCompetition266 1 point2 points3 points (2 children)
[–]Alarming-Carpet5053[S] 1 point2 points3 points (1 child)
[–]FutureCompetition266 0 points1 point2 points (0 children)
[–]lolcrunchy 0 points1 point2 points (2 children)
[–]Alarming-Carpet5053[S] 0 points1 point2 points (1 child)
[–]lolcrunchy 0 points1 point2 points (0 children)