Help me short the code, and is it possible to do it?
-
Just started studying. Orphographic errors are not interesting, I know what I have. Can we short or simplify the code?
-
Well, I've rewritten your code to correct the mistakes. That's what happened:
available_pizza = ["Pepperoni", "Salami", "Margarita", "AlL Fungi", "Capricious", "Hawaii"] available_topping = ["Double cheese", "BBQ", "Spinet", "Champions", "Tomato", "Brie"] print("We have " + ", ".join(available_pizza)) print("And you can add some topping in your Pizza") print("\n".join(available_pizza)) chose_pizza = ["Pepperoni", "Margarita", "Hawaii", "Quarto Cheese"] chose_topping = ["Double cheese", "Tomato", "Cheddar"] print(f"You have chosen {', '.join(chose_pizza)}. With {', '.join(chose_topping)}") for topping in chose_topping: if topping not in available_topping: print(f"I am Sorry we don't have {topping}") for pizza in chose_pizza: if pizza not in available_pizza: print(f"I am sorry we don't have {pizza}") else: print("You can finish you order Now")
I'm not strong in the python, so I'm sure you can make it easier.