Lesson 7 Or. Help, I am confused!


#1



This is the link to the lesson I'm stuck on
https://www.codecademy.com/courses/python-beginner-BxUFN/2/3?curriculum_id=4f89dab3d788890003000096#


These are the errors that come up;
'Make sure you have a value for all 5 variables!'
'File "python", line 3
SyntaxError: can't assign to operator'


The problem:
The assignment was to use the OR function, and set each boolean with a specific true/false statement which are stated below
Set bool_one equal to the result of 2**3 == 108 % 100 or 'Cleese' == 'King Arthur'
Set bool_two equal to the result of True or False
Set bool_three equal to the result of 100**0.5 >= 50 or False
Set bool_four equal to the result of True or True
Set bool_five equal to the result of 1**100 == 100**1 or 3 * 2 * 1 != 3 + 2 + 1

I have checked the code, so has my friend - so we would like a third party to read over it since we can't find the fault. We have also restarted the code and


The code

bool_one = 2**3 == 108 % 100 or 'Cleese' == 'King Arthur'

bool_two = 1 + 2 = 3 or 1 - 2 = 567

bool_three = 100**0.5 >= 50 or 4 + 2 = 7

bool_four = 1 + 1 + 1 = 21 or 2 + 2 = 69

bool_five = 1**100 == 100**1 or 3 * 2 * 1 != 3 + 2 + 1

That seems just about it, Thank you!


#2

Hi @ebster,

You have an assignment operator in here, making it an invalid expression ...

bool_three = 100**0.5 >= 50 or 4 + 2 = 7

#3

But in the lesson it says
'Set bool_three equal to the result of 100**0.5 >= 50 or False'
How would I fix my code and still finish the assignment?


#4

Replace = with the operator that tests for equivalence, which is ==.


#5

Oh, thank you, sorry for taking up your time


#6

Just tried it and it gives me another syntax error

File "python", line 5
bool_three = 100**0.5 >== 50 or 4 + 2 = 7
^
SyntaxError: invalid syntax


#7

No problem; enjoy the course :smile:


#8

= by itself is an assignment operator. For the bool_four line, you have two in here that need to be replaced ...

... 1 + 1 + 1 = 21 or 2 + 2 = 69


#9

Thanks! I changed all = into ==
and turned bool_four to True or True


#10

Actually, you only need to have either True or False after the assignment operator on each line. For example, the instructions have this ...

Set bool_four equal to the result of True or True

Based on the value of the specified expression, which is True or True, you only need to do either this ...

bool_four = True

... or this ...

bool_four = False

However, Codecademy accepts more complex expressions as well.


#11