Mix 'n' Match


#1

https://www.codecademy.com/courses/python-beginner-BxUFN/2/6?curriculum_id=4f89dab3d788890003000096

This is the error message that has been displayed
File "python", line 10
bool_three = (4**4 != 4**4) or not(1**(5/8) == 1) and (0 == 0**1)
^
SyntaxError: invalid syntax

I have understood why this error message has occurred since my parenthesis on 'bool_two' doesn't match. But my question is why does the error message indicate that the error has occurred one line after actual line where the error has occured

# 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 = not "Hello" != "Hola" or (2**3 == 4*2) and ((4-8 < 0) or ( 1 <= 1)

# Make me false!
bool_three = (4**4 != 4**4) or not(1**(5/8) == 1) and (0 == 0**1)

# Make me true!
bool_four = not ( 1 != 0**1) or ( 4>1 and 8==(12-4))

# Make me true!
bool_five = ( 5*5 == 5**2) and (not not not ( 1 == 0 or 0 == 1))

#2

The error pointer indicates where parsing stopped. Go back from that point to find the error above. There is a missing right parenthesis.


#3

I think not only its expression number three is wrong but as well your number four expression it's wrong, I guess.
My exercise in this lesson it was very simple, nothing too detailed. I'll try to explain what's wrong with your code soon, very briefly, wait just a little bit.

I will per part.
Try to separate the boolean operator "not" of the declaration "(1 ** (5/8) == 1)".


#4

It yields True, so what is wrong about it?


#5

My level in mathematics no It is so good for explain in form Technical or do not. Neither same my English written It is, much good. Up until because I I'm Brazilian and my level at the English written It is median.
But I, I will to attempt explain according to development gives question.


#6

Sorry if I framed my question poorly but I realize that there is a missing right parenthesis. When I ran the code, the error message indicated that the error was on line 10 when actually the error of the missing right parenthesis was on line 7.
Which had me confused for a long time.
So, my question is why does the error message indicate that the error is in line 10 instead of line 7.

P.S: I have attached a screenshot for reference.


#7

The indicator arrow only points to where parsing stops. The error that caused it to stop is before that point.


#8

Ah, now I get it. Thank you so much.


#10

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