Conditionals & Control Flow 7.0 OR


#1

Hello all,

It appears that one question seems to be incorrect in the training:
https://www.codecademy.com/courses/python-beginner-BxUFN/2/3?curriculum_id=4f89dab3d788890003000096#

Q: Set bool_one equal to the result of 2**3 == 108 % 100 or 'Cleese' == 'King Arthur'

Per Wolf Ram Alpha "2**3 == 108 modulus 100" the answer is False
Source: http://www.wolframalpha.com/input/?i=2**3+%3D%3D+108+modulus+100

False Or False = False
The code is wanting True. I'm able to continue but it could be confusing for others.


#2

I cam across the same thing. I eventually changed it to True and it worked.


#4

@tylerwbennetgmail.co: The statement is true.

2**3 -> 8
108 % 100 -> 8 *the module operator will get the remainder of the division of 108 by 100

So 2**3 is equal to 108 % 100.
Since the logical operator used is OR, you'll just need one of the statements to be True so the result will be True.


#5

2**3 ist still =6 in my book. How can this be =8 then?
What am I missing?


#6

There's a difference between '' * '' and " ** "
Whenever we use one asterisk, and using two numbers, we are telling our program to simply multiply one element with the other, once (considering you're not looping or anything like that).
While two asteriks will tell your program to get the number at the left and bring back that exact same number to the power of the number on the right side.

3 * 2 # 6
3 ** 2 # 9 because is the same as pow(3,2)

#7

It took me forever to figure out what I was missing.
The font in the instructions makes the "108" look like "100"
So I read this as "100 % 100" instead of "108 % 100", so I got 0 instead of 8.


#8

Is 'Cleese' == 'King Arthur'? It's been a while...


#9

Apparently Cleese == King Arthur


#10

I eventually worked out that this was true because '%' gives the remainder of a division, rather than the result of the division itself (the operator for that is '/'). So the result is 8, not 1.08 as I initially thought, and 8 = 2**3.