Why doesn't code?

print("What do you want for Breakfast?")
print("1.Scrambled eggs")
print("2.Sandwich")
print("3.Belgian waffles")
MainChoose = int(input("Choose a dish for tomorrow: "))
if (MainChoose == 1):
 Meal = "scrambled Eggs" and price1 = 300
elif (MainChoose == 2):
 Meal = Sandwich and price1 = 250
elif (MainChoose == 3):
 Meal = "Belgian waffles" and price1 = 400 

print("What sandwich do you want?")
print("1.Ham")
print("2.Fish")
print("3.With butter") 
Bread = int(input("Choose a sandwich: "))
if (Bread == 1):
 sndwch = "ham Sandwich" and price2 = 250
elif (Bread == 2):
 sndwch = "Sandwich with ham" and price2 = 280
elif (Bread == 3):
 sndwch = "Sandwich butter" and price2 = 265


print("What drink do you want?")
print("1.Juice")
print("2.Tea")
print("3.Coffee") 
Bread = int(input("Select a drink: "))
if (Bread == 1):
 drink = "Juice" and price3 = 100
elif (Bread == 2):
 drink = "Tea" and price3 = 90
elif (Bread == 3):
 drink = "Coffee" and price3 = 105


print("Your Breakfast ")
print("Main dish:" + MainChoose)
print("Sandwich:" + Bread)
print("Drink:" + drink)


On line 11 gives errorin
Meal = "Belgian waffles" and price_1 = 400
Writes that "can't assign to operator"
April 4th 20 at 00:34
2 answers
April 4th 20 at 00:36
Solution
You probably mean either this:
Meal = "Belgian waffles" and price1 == 400

either way:
Meal = "Belgian waffles"
price1 = 400


= - assignment (let a equal b)
== - verification of identity (is it true that a is equal to b; if a is equal to b)
I meant that if the user chooses option 3, the variable price1(there was a bug in the code) Meal, and are assigned values - Colin_Walsh commented on April 4th 20 at 00:39
Then you second option:
Meal = "Belgian waffles"
price1 = 400
- king.Grant commented on April 4th 20 at 00:42
and, or, not in Python is the Boolean operators, they return either True or False.
In your case the program was understood thus:

Assign a Meal to a logical expression "'Belgian waffles' and price1 = 400", where 'Belgian waffles' = true (because the string is not empty) and "price1 = 400"... Exception! (because price1 = 400 this variable assignment, not a logical expression -> it does not return neither True nor False) - king.Grant commented on April 4th 20 at 00:45
April 4th 20 at 00:38
= vs ==
but if you really want to do there assignment, so it is impossible
Do not get it) - Colin_Walsh commented on April 4th 20 at 00:41
@Colin_Walsh, then you should read a tutorial on Python. - gia.Smith commented on April 4th 20 at 00:44

Find more questions by tags Python