0
print ("Welcome To Femboii's Restaraunt")
Name = input ("What's Your Name Sir?\n").capitalize()
EvilGuys = ["Jack", "Ben", "Maria"]
if Name in EvilGuys:
    Evil_Status = input ("Are You Evil " + Name + "?\n").capitalize()
    if Evil_Status == "Yes":
        Good_Deeds = input ("How Many Good Deeds Have You Done Today " + Name + "?\n")
        Bad_Deeds = input ("How Many Bad Deeds Have You Done Today " + Name + "?\n")
        Good_Deeds = int(Good_Deeds)
        Bad_Deeds = int(Bad_Deeds)
    elif Evil_Status == "No":
        print ("Oh, So You Aren't Evil, Come In You're Welcome!")
    else:
        print ("Sorry I Didn't Understand You, So Ill Just Take It As A No")
    if Good_Deeds >= Bad_Deeds:
        print ("Oh, So You Aren't Evil, Come In You're Welcome!")
    if Good_Deeds < Bad_Deeds:
        print ("GET OUTTTT RIGHT NOWWWWWWWWWW!!!!!!!!!!")
        exit ()
print ("Welcome " + Name)
FoodMenu = ("Pizza, Crepe, Burger And Shawrma.")
DrinksMenu = ("Black Coffee, Latte, Mocha, Espresso, Crapuccino And Sparkling Water")
FoodMenuList = ["Pizza", "Crepe", "Burger", "Shawrma"]
DrinksMenuList = ["Black Coffee", "Latte", "Mocha", "Espresso", "Crapuccino", "Sparkling Water"]
Order = input ("Here's Our Food Menu\n" + FoodMenu + "\nAnd Here's Our Drinks Menu\n" + DrinksMenu + "\nChoose What Serves You The Best.\n").capitalize
while Order not in FoodMenuList or Order not in DrinksMenuList:
    if Order in FoodMenuList or Order in DrinksMenuList:
        break
    if Order not in FoodMenuList or Order not in DrinksMenuList:
        input ("Sorry, I Didn't Understand What You Said, Can You Repeat?\n").capitalize()
print (Order)

I Tried To Make It So If He Asked For Something That is not In The menu tells him that the code the ai whatever

could not understand him and if he keeps doing this it will keep saying the

Sorry, I Didn't Understand What You Said, Can You Repeat

and the while loop does not stop

2
  • 1
    Did you mean Order not in FoodMenuList and Order not in DrinksMenuList (a and instead of or) Commented Dec 11, 2022 at 11:24
  • 1
    1) If the first if condition is False (i.e. Order is not in either Menu), you don't need a 2nd condition to check that Order is not in either menu. 2) You need to update Order by assigning result of input e.g. Order = input("Sorry, ... (i.e. just calling input does not update Order). Commented Dec 11, 2022 at 11:29

4 Answers 4

1

Uhm, you forgot to push input(...) into Order. Currently it's:

while Order not in FoodMenuList or Order not in DrinksMenuList:
    if Order in FoodMenuList or Order in DrinksMenuList:
        break
    if Order not in FoodMenuList or Order not in DrinksMenuList:
        input ("Sorry, I Didn't Understand What You Said, Can You Repeat?\n").capitalize()
print (Order)

You need:

while Order not in FoodMenuList or Order not in DrinksMenuList:
    if Order in FoodMenuList or Order in DrinksMenuList:
        break
    if Order not in FoodMenuList or Order not in DrinksMenuList:
        Order = input ("Sorry, I Didn't Understand What You Said, Can You Repeat?\n").capitalize() # here
print (Order)

Also you can rewrite your program in way that there will be no repeated code, but it's your choice, heh.

Personally, I'd write something like this, because it's checking for being in menu in while condition:

while Order not in FoodMenuList or Order not in DrinksMenuList:
    Order = input ("Sorry, I Didn't Understand What You Said, Can You Repeat?\n").capitalize()
print (Order)
Sign up to request clarification or add additional context in comments.

2 Comments

But There is still a problem after fixing it still looping and doesn't break the loop after
Check out other answers, they're right, it seems, you have problem with while-condition. Try out while not (Order in FoodMenuList+DrinksMenuList):
0
while not (Order in FoodMenuList or Order in DrinksMenuList:
    if Order in FoodMenuList or Order in DrinksMenuList:
        break
    if not (Order in FoodMenuList or Order in DrinksMenuList):
        input ("Sorry, I Didn't Understand What You Said, Can You Repeat?\n").capitalize()
print (Order)

Probably has to do with logic. You see:

not P and not Q != not (P and Q) 

Comments

0

As others have already pointed out the problem seems to be in the logic of the program.

while Order not in FoodMenuList or Order not in DrinksMenuList:

Here you're checking if the order isn't in the food menu or if the order isn't in the drinks menu.

This will always be True because the order can't be both in the food menu and in the drinks menu at the same time.

What you want to do is replace or with and. That way it will return True only if the order is in neither of the menus.

Another way of doing it is combining the two menus and checking if the item is in there:

while Order not in FoodMenuList+DrinksMenuList:

Also unrelated to the problem but it's not advisable to use + signs to format your strings:

"How Many Bad Deeds Have You Done Today " + Name + "?\n"

A better way of doing it is to use format strings:

f"How Many Bad Deeds Have You Done Today {Name}?\n"

Comments

0

My answer will seem a bit unpopular amongst the answers to this question. There is a syntax error in line

Order = input ("Here's Our Food Menu\n" + FoodMenu + "\nAnd Here's Our Drinks Menu\n" + DrinksMenu + "\nChoose What Serves You The Best.\n").capitalize

capitalize() is an attribute and not a characteristic of string data type hence it needs to be invoked with a parenthesis.

When the function is invoked without a parenthesis, a completely different element is stored in the variable "Order" which is why the code isn't relating to the keywords provided in FoodMenuList and DrinkMenuList

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.