The code won’t run whether you enter True or False for the answer? What?!? It has to be one or the other.
I am having the same problem
Not sure I understand the problem you are experiencing…?
The instruction goes as follow:
Set bool_four equal to the result of -(12) < 20 and 10 % 10 <= 20 - 10 * 2
so if we print the segments:
print -(1**2) < 2**0 # will return True print 10 % 10 <= 20 - 10 * 2 # will return True as well # so... bool_four = -(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2 print bool_four # will return True since True and True will be True
It doesn’t say anything about printing, the bool should be True, but as the original poster says, whether you use True or False it keeps saying to check the answer! So anyone from codeacademy reading please can you help?!
Please paste the code you are trying to run otherwise it is very difficult to try and help you!
Here’s a little trick:
Whenever you would like to paste code, since this forum supports Markdown you can use three backticks before and after your code block like so:
my_var = 0
if x > my_var:
sum = my_var + x
and it will retain proper indentation and even have nifty syntax highlighting:
def my_func(x): my_var = 0 if x > my_var: sum = my_var + x else: print "Odelay!" return sum
Also, you are right it is not necessary to print for the exercise to be completed, but sometimes using print statement helps us debug and understand what’s going on under the hood which in turn makes the solution to our problem much more obvious and that’s why I was using them.
I’m experiencing the same issue. I have thrown the code into the IDE, works just well. The problem is with the site I think at this point because it is failing to read the correct answer which is True.
This is what I am dealing with:
bool_four = -(12) < 20 and 10 % 10 <= 20 - 10 * 2 is True
The response I am getting is:
Oops, try again. Double check your value for bool_four!
Please copy and paste your entire code here so we can try and find what is wrong. It is common to have an error message points something (in this case bool_four) but having the actual problem lies somewhere else in the code or in the indentation of it.
Use the code formatting trick I have posted earlier in this thread to keep indentation verbatim since without it, proper troubleshooting is impossible for us…
Copy and paste your code somewhere and replace it with the following and see if it works. Report here with your results. Still do post your code here please so we can try and find what is wrong.
bool_one = False and False bool_two = -(-(-(-2))) == -2 and 4 >= 16 * 0.5 bool_three = 19 % 4 != 300 / 10 / 10 and False bool_four = -(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2 bool_five = True and True
It worked right. Thanks very much for your help. My code was something like this:
bool_one = False and False
bool_two = -(-(-(-2))) == -2 and 4 >= 16 * 0.5
bool_three = 19 % 4 != 300 / 10 / 10 and False
bool_four = (12) < 20 and 10 % 10 <= 20 - 10 * 2
bool_five = True and True
My bool 4 had no NEGATIVE sign just as it is above.
Great @chinyani, I’m glad I could help you find it!
Remember, for your next requests on this forum, to wrap your code with three backticks (like these ```) before and after your code. You can also use the symbol that looks like this </> in the message editor toolbar. Both will create a code block and will have your code rendered properly, this way we can start troubleshooting and helping you right away.
The same I had. To get through that error (IMO), could be used some other expression, e.g.:
I had no issue submitting the answer. What I don’t understand is why bool_four is TRUE. The result of the equation should be True and False, which should return the result as False. Anyone could help explain?