How does 'Cleese' == 'King Arthur' equal True?

The question was for ‘Or’ statements

  • Set bool_one equal to the result of

2 ** 3 == 108 % 100 or ‘Cleese’ == ‘King Arthur’

And the answer is allegedly True. The first math problem is false so apparently ‘Cleese’ == ‘King Arthur’ Is true. There was nothing taught about this yet. Is it true because it’s just two strings?

There is also inconsistency in the format. The last set of questions asked to make the same kind of statements that equaled true or false and then pretty much asked the same question but we were supposed to just answer True or false. So I ended up making a bunch of expressions that would equal true or false when I didn’t need to.

I’m finding this codecademy lacking in explanation and jumps around too much. I’m glad I haven’t paid yet.

2 Likes

Sometimes these sorts of questions require a bit of research. This question also requires some humor and a bit of pop cultural & film knowledge. Who’s John Cleese? Ever heard of the film “Monty Python and the Holy Grail”? It’s classic. (It also gets quoted a lot bc the Python programming language was named after the British comedy troupe, Monty Python). A bit of research about the history of the programming language will reveal that. (Also, the people who composed these courses clearly have a sense of humor.) I’m a fan and have seen the film many, many times. :rofl:

Anyway…

John didn’t play the character of King Arthur in the film, Graham Chapman did. So, that side of the expression, John Cleese==King Arthur is False.

So, if that side of the expression evaluates to False, then what about the other side?

4 Likes

so… how is 2 ** 3 == 108 % 100 true?

See you are still waiting so chiming in…

2 ** 3

That is two to the third power. We should have this memorized.

108 % 100

That is the remainder of one-hundred divided into one-hundred-and-eight.

From what we can see, they are identical results.

1 Like

Got it, just needed a better understanding of how % works. The way the lesson taught it, I was almost certain the result of 108 % 100 = 1.08 but I must’ve misunderstood.

1 Like

In Real Number division, 108 / 100 is 1.08. Now take only the decimal portion and multiply it by 100 (the divisor), and voila, 8.

For our purposes we are not thinking Real Number division, but its subset, Integer division. This gives us integer remainders. We can further narrow this to positive dividend and divisor, and put the negative question far out of reach, for the moment. You will learn about that in your studies.

  divisor
   /   Dividend
  /     /
100 ) 108  |  1  quotient
    - 100  <== quotient times divisor
    ______
        8    Remainder

When we floor divide we get an integer quotient.

108 // 100  ==  1

If we subtract the quotient times the divisor we get the Remainder.

Let this equation burn into your memory:

D - R == q * d

Rearranging we, get,

 D - q * r == R

or in plain math speak,

R = D - qr

Sorry, I was/am watching baseball. :baseball:

You could also think of it like this:

If it’s True or False, then it will always result in True. If one side of an or expression is True, it will always be True.