so to explain im working on a code for school and i want to have my code check if the string doesn’t match i want it to output true if there isnt any of the checked text but no matter what i do it runs a error. Please help me this is due tomorrow and im so confused. i cant post images so i will paste my code below.
#I want the code below to check if my variable (sandwich) has the preset text in it and if the text does not match i want it to output true instead of false.
#I want this to set true if this is false but i cant figure out how to get my NOT statment working.
elif Sandwich not == “chicken” or “beef” or “tofu”:
print (“you have choosen an invalid choice please try again”)
quit(“invalid”)
the error i keep getting is invalid syntax at my == section
submitted by /u/Silent_Profit_4098
[link] [comments]
r/learnpython so to explain im working on a code for school and i want to have my code check if the string doesn’t match i want it to output true if there isnt any of the checked text but no matter what i do it runs a error. Please help me this is due tomorrow and im so confused. i cant post images so i will paste my code below. #I want the code below to check if my variable (sandwich) has the preset text in it and if the text does not match i want it to output true instead of false. #I want this to set true if this is false but i cant figure out how to get my NOT statment working. elif Sandwich not == “chicken” or “beef” or “tofu”: print (“you have choosen an invalid choice please try again”) quit(“invalid”) the error i keep getting is invalid syntax at my == section submitted by /u/Silent_Profit_4098 [link] [comments]
so to explain im working on a code for school and i want to have my code check if the string doesn’t match i want it to output true if there isnt any of the checked text but no matter what i do it runs a error. Please help me this is due tomorrow and im so confused. i cant post images so i will paste my code below.
#I want the code below to check if my variable (sandwich) has the preset text in it and if the text does not match i want it to output true instead of false.
#I want this to set true if this is false but i cant figure out how to get my NOT statment working.
elif Sandwich not == “chicken” or “beef” or “tofu”:
print (“you have choosen an invalid choice please try again”)
quit(“invalid”)
the error i keep getting is invalid syntax at my == section
submitted by /u/Silent_Profit_4098
[link] [comments]