I have experimented in the lab and worked out that both my statements are true, but CodeAcademy is not accepting it. Any help, please?
please give code and exercise link? Thanks!
Here is the code you requested:
bool_four = -(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2 is True and True
The exercise is number 6 And under the heading Conditionals and Control Flow. I think it is part of the 3rd lesson.
Thanks very much for offering to help.
is operator tests if two objects are the same.
 is  # False
Don't use it here, you'll know how to use it if and when you need it (won't need it in the Python track here at the very least)
in your statement 20 - 10 * 2 this equals 0 so it is not grater then. try less then and it should work. The interpreter sees this statement as 20 - 20 = 0 is less then or equal to 10% 10 = 1. Do you see it now? hope this helps
Thanks for your help, djm.
The statement 10 % 10 <= 20 - 10 * 2 is given in the exercise so I don't think I'm expected to change it.
However I do agree with you that 20 - 10 * 2 = 0, also 10 % 10 = 0, so either greater than and equal to OR less than and equal to should work. Being desperate I did change it to less than or equal to, though, and it didn't work.
I've since moved on to some of the other lessons and I seem to be ok with them. I would still like to resolve this puzzle if I can, though. Thanks again.
All the other expressions worked with is True or is False, gaurangtandon. Thanks for your help, though.
Seems bugged to me. You basically copy the text "-(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2" and you decide whether it "is True" or "is False". Neither of those work, so I think it's bugged. I'm having the same problem. Unless we're overlooking an instruction somewhere.
Dear @chiprockstar10213 and @bluecity_uk, as @ionatan explained earlier, you do not need to use the
is operator at all, it's something which the exercise isn't expecting. You just need to assign literal boolean values (
False) to the five variables.
Passing the exercise isn't necessarily the same as having done it correctly.
False so.. there's a 50% chance to get the right one huh?
The instructions are to assign "the result of some boolean expression" and the result of a boolean expression is a bool:
bool_fifteen = True
I got the answer right. Since only True AND True condition gives True, and that is what you got after solving the problem, your answer should simply be bool_four = True
bool_four = -1 < 1 and 0 <= 0 is True
please i need help.
Oops, try again.
Double check your value for bool_four!
I have fixed this by doing what the_ayenipaul suggested, ie just stating that bool_four is True and True, and, hey, I passed the exercise.
I have been working these things out in Excel at the same time though and the answer is definitely True and True. I think my mistake was in the way I copied the numbers and the operators, but I'm not sure and I don't really know what my copying mistake was.