10/15 - what do i get syntax error?


#1

Make me false!

bool_three = not (25 == 5 ** 2)
         ^

SyntaxError: invalid syntax


#2

can you post your full code?


#3
# Use boolean expressions as appropriate on the lines below!

# Make me false!
bool_one = (2 <= 2) and "Alpha" == "Bravo"  # We did this one for you!

# Make me true!
bool_two = (5 == 5) and (16 == 4**2

# Make me false!
bool_three = not (25 == 5 ** 2)

# Make me true!
bool_four = not True or 104 % 100 <= 2 * 2

# Make me true!
bool_five = not not not not 4 == 4

#4

that explains the error, look at this line:

bool_two = (5 == 5) and (16 == 4**2

does anything look off?


#5

yep, no parentheses. it helped! although it was saying that the error is in another lineā€¦ thanks


#6

that is because parentheses allows you to put the code over multiple lines:

bool_two = (5 == 5) and (
16 == 4**2
)

which is why the error message is later.


#7

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