+ 1
Can someone assist, what's wrong with this code? I'm a rookie in python
dinner=input("What did you eat") if dinner=food: print("Keep on eating") else: print("The program has ended")
4 Answers
+ 5
if dinner == "food":
= is assignment operator
== is used to check equality
+ 2
YOU SHOULD USE == IN THE PLACE OF =
=(is equal to) is used for assigning the values to a variable
and
== is used to compare the value of variables
^°,,°^
+ 1
Thank you. It worked like a charm.