Lesson 9 "This and That (or This, But not That)" Problem


#1

So I'm relatively new to codecademy.com, but I have run into an problem in the Python class.

Lesson 9 "This and That (Or This, But Not That)"

Console Response: None
Error: Oops, try again. Double check your value for booltwo!_

The console finds the math to add up, but somehow it isn't matching the EXACT instructions for what I am to put in for "bool_two"

The Instructions:

Assign True or False as appropriate for bool_one through bool_five.

Set bool_one equal to the result of False or not True and True
Set bool_two equal to the result of False and not True or True
Set bool_three equal to the result of True and not (False or False)
Set bool_four equal to the result of not not True or False and not True
Set bool_five equal to the result of False or not (True and True)

My Code:

bool_one = 41 < 40 or (not (4*4 == 16 and 14 + 1 == 15))

bool_two = 41 < 40 and (not (4*4 == 16 or 14 + 1 == 15))

bool_three = 1 + 1 == 2 and (not (1 + 1 == 3 or 3 * 3 == 12))

bool_four = not (not (1 + 1 == 2 or 1 + 1 == 3)) and (not 1 + 1 ==2)

bool_five = 1 + 1 == 3 or (not (1 + 1 == 2 and 3 + 3 == 6))

I cannot seem to pass "bool_two", but I cannot find the problem for the life of me. Any suggestions are welcome. Thanks.


#2

Ok so you have fallen for a common mistake that many come across when dealing with these lessons particularly between 5 and 10 in the fact that the lesson is not asking for equations to give the result of the question but in fact just whether or not the question is true or false. So your answer will simply be true or false. I think what you have done is a marvelous exercise for one's own benefit but I am afraid it won't take you past this lesson!

So for example 1.) is ,"Set bool_one equal to the result of False or not True and True." So we evaluate not True first which is False so it really reads False or False and True. We then evaluate and second so False and True is False. So we get False or False which evaluates to False. Therefore, our answer is False so our answer would be bool_one = False.

Note: I believe I got this correct in explaining it but if I error please someone correct me. I can confuse myself in these haha.


#3

Thanks for the quick reply!

What you said makes perfect sense, so at the end of my code, I simple added

print bool_one
print bool_two
and so on...

Which gave me the results of each equation in the console. Then I was able to simply change the outcome of "bool_two" to true instead of false.

Thanks again!


#4

No problem! I know I hate when I do a lot of work and it is sort of for "nothing" but honestly what you did was very impressive! Keep it up and happy coding! :smiley:


#5

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