I do not understand this at all


#1

What does this mean?
AND was easy but OR makes no sense

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

Where I get confused
bool_one = True because 2**3=8 and 108 % 100=8
bool_two = WHAT?
bool_three = True because 100**0.5=50 which makes it true?
bool_four = WHAT?
bool_five = True


#2

if this condition:

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

evaluates to true, you need to set bool_one to true:

bool_one = True

if this condition evaluates to false, you would have to set bool_one to false:

bool_one = False

shall we do the first one together? there are two pieces, piece one:

2**3 == 108 % 100

2 ** 3 is 8 ( 2 * 2 * 2) and 108 % 100 is also 8:

8 == 8

which is true. then the second piece:

'Cleese' == 'King Arthur'

well, the strings are not equal, so this is False, so then we have:

True or False

lets look at this table:

True or True # is true
True or False # is true
False or False # is false

so or is always true if at least one of the conditions is true. conclusion, bool_one is true:

bool_one = True

#3

Ok I realize @stetim94 has already beaten me to the punch but I have type all this out and I am going to finish lol
Or
The boolean operator or returns True when at least one expression on either side of or is true. For example:

1 < 2 or 2 > 3 is True;
1 > 2 or 2 > 3 is False.

So or is basically just that. I think the instructions explain it well. However, the hard part is doing some of these math equations and such xD For lessons like this I would suggest doing a calculator just to make sure. Based on the definition, lets look at two through five which are the ones you are confused on or got wrong.

2.) Set bool_two equal to the result of True or False. The result of an or statement with true or false is true because one side is equal to true. It is still true even though one side is false. That is the big difference between and/or. And has to be either both true or both false while or can be all true all false or a mixture of true and false.

3.) Set bool_three equal to the result of 100**0.5 >= 50 or False. 100 to the 1/2 power is equal to 10 so it is false because 10 is less than 50 and is not equal to 50. So this or expression is false because it is false on both sides of the equation.

4.) Set bool_four equal to the result of True or True. This one is easy because it can't be anything but true. Both sides are true therefore either side is true so your answer is true. (deep lol)

5.) Set bool_five equal to the result of 1**100 == 100**1 or 3 * 2 * 1 != 3 + 2 + 1 Now unlike the others this one has multiple equations to do. 1 to the 100th power is not equal to 100 to the 1st power because you get 1 == 100. Also, 3 * 2 * 1 != 3 + 2 + 1 is false as well so your answer is false!

Like I said I realize Stetim94 beat me to the punch but I was on four so I was committed xD


#4

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