The variables bool_one through bool_five are meant to be assigned the value True or False depending on whether or not the expressionabove it is true or false.
When trying to determine the truth value of a expression, it can be helpful to break down each side of an operator before trying to solve the entire expression. Let’s look at the example below:
# Consider the expression: (35 + 20) <= ((100 - 50) +5)
# The left half results in 55
# The right half has two parts that result in (50) + 5, or 55
bool_googol = True # 55 is indeed less than or equal to 55
Do you have to put a comment before the variable for the True or False answer to be associated with it?
How do I know what i put will take the true or false statement?
-mostly talking about this part of the code - # (20 - 10) > 15 is this how you make the true and false statement?
Am I supposed to be the one who decide whether each variable is true or false depending on the expression you gave for each variable or am I supposed to write something that makes the program know that the truth value of each variable depended on the expressions you gave for each variable?
It’s been given in the script.py as "# Remember that ** can be read as 'to the power ". For example 3**4 means 3 to the power of 4 which is (3 x 3 x 3 x 3) equal to 81.
what is the answer for this, I cant seem to see the answer?
1.
Let’s run through the comparators again with more complex expressions. Set each variable to True or False depending on what you think the result will be.
Am I being stupid or has this exercise been filled in for me? All the answers to this were already recorded as being True or False and all were correct. Confused?
You can put the comment ‘#’ wherever you want. It can come before, at the end of the statement line, or afterwards. It’s a matter of coding style but being that the comment is supposed to tell us something about what you are about to ‘state’ then it makes sense that we put it before or above the statement line.
The CodeAcademy process that evaluates your program is simply looking for:
bool_five = False
It is assuming that this variable is being set according to a ‘comment’ above it (100 != 100**2) and therefore in your comment you could put # Today is the end of the world and then set bool_five = False and it wouldn’t know what exactly you’re declaring the variable to be.
Your comment line ‘#’ does nothing to make the statement True or False.
All of the answers are pre-filled on these, but this exercise (and the previous, which had the same issue) seem strange.
Is the point you’re making that we (the programmer) need to think ahead about what different boolean values might be in our sequence, so that we can create efficient if/then/else?
Having the human do the math on these seems dumb when the description says the point is of booleans is to make the computer do the eval.
When i loaded this lesson all the variables were already assigned correctly, not just the one that has the comment “we did this one for you”. There was nothing for me to do other than double check that they were correct.