How can I make a list equal if it has the same strings but in a different order? For an example.. The customer wants a Pineapple and Ham pizza.
Heres the function for when I makes a pizza for the customer. I add Pineapples than I add Ham to mPlayer.last_pizza list.
def add_toppings():
choice_input = input(f"""
Toppings:{mPlayer.last_pizza} Baked:{mPlayer.baked} Sliced:{mPlayer.cut}
C - Add Cheese
H - Add Ham
J - Add Jalapenos
P - Add Pineapples
A - Add Pepperoni's
S - Add Sausages
Clear - Clear Toppings
Exit - Exit
**** Make a Selection ****
After I exit the add_toppings function to go to the delivering method. I type "1" and the if statement gets executed.
def delivering(self, e, b, c, d, ):
print(mPlayer.last_pizza)
choice_input = input(f"""
1 - {self.address}
2 - {b}
3 - {c}
4 - {d}
5 - {e}
**** Choose the customer house to deliver the pizza ****
""")
if choice_input == '1' and mPlayer.last_pizza == self.customerdir:
print(self.name + ": Thank you so much you are a life saviour!")
mPlayer.last_pizza.clear()
But if the toppings are in a different order like "Ham", "Pineapples" the if statement never gets executed.
How can I make it work even if the toppings aren't in the same order as the customer's list?
Thank you so much.