# Why am i getting syntax error

#1

``````bool eggs = False
bool spam = True``````

#2

False and True are booleans, its there data type. No need to use bool eggs. just use eggs.

#3

I am typing:

``````spam = true
eggs = false``````

and still getting an error message.

Why?

Thanks.
Michael

#4

Try capatillise T and F

#5

Thanks.
Now I'm having trouble with the problem below; adding the cost of a meal + tax (.675) + tip (.15). Can you show me the answer please? Here are the instructions.

Okay! We've got the three variables we need to perform our calculation, and we know some arithmetic operators that can help us out.

We saw in Lesson 1 that we can reassign variables. For example, we could say spam = 7, then later change our minds and say spam = 3.

Instructions
On line 7, reassign meal to the value of itself + itself * tax. And yes, you're allowed to reassign a variable in terms of itself!

We're only calculating the cost of meal and tax here. We'll get to the tip soon.

?
Hint
Let's see: meal * tax will give you the number of tax dollars to put on your bill, and meal + that number will give you the cost of the meal + tax!

The interpreter will evaluate the right-hand side of the equation first. It will ask itself, "What's meal * tax?" Once it does this and gets the result (about 3.00), it will ask itself, "What's meal + this number?" (44.50 + about 3.00 = about 47.50.) Finally, it'll move to the left-hand side of the equation and say, "Oh man, I should totally reassign meal (which was 44.50) to this new value of about 47.50." And that's how meal gets reassigned!

#6

Meal=meal+(meal*tax) +(meal*tip)

#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.