In the past couple of days some lessons have been appearing glitched, and contain a mystery stray, py
. If you encounter this in any other lessons just know that the system is messing up generating the lesson text.
Thanks for clearing that up. As a math nerd, I thought I was going crazy.
What exactly is 6/15 looking for as far as syntax.
this is what I got but im not sure if i should be writing the actual math, true and true ( true and false or false and false as it may be or just True) bool_one = False
This is what I got as my end result but im not sure if im doing it properly
bool_two = False
bool_three = False
bool_four = True
bool_five = True
A breath of fresh air. Finally we see someone who evaluates the expressions in their head, as expected. You have done exactly what was expected, so if you get any of the above wrong, re-evaluate that expression and find why you got it wrong. Donāt use the computer to solve these questions.
Thank you for the response! I figured out that if you get no response from code academy for these then that is correct. I was expecting something to print I guess.
I donāt get whatās the point of the exercise and the ones the follow? we are just copying and pasting
There is no copying and pasting required, and is in fact the incorrect way to approach these problems. We are meant to examine the expressions and work out their logic in our head, then write in the evaluation we arrive at. True
or False
.
So the point is doing the maths? but we are just writing it exactly the way it asks
like why are we assigning bool_one to False and false? on what basis/what for?
and how is this considered a result : 19 % 4 != 300 / 10 / 10 and False
Iām so lost here.
The maths are quite simple but will pose a challenge if one hasnāt covered it at school.
%
is the modulo operator, also known as the remainder operator.
19 % 4
yields the remainder of the integer division of 19 by 4.
4 * 4 == 16
19 - 16 == 3
so,
19 % 4 == 3
The right side division is the same as 300 / 100 which is also 3
.
3 != 3 => False
so that is the answer we give for that question.
Hi, Iāve just started on this and it was all going great, but I admit to being completely stumped by this exercise. Firstly, there seems to be no prior explanation of things like -(-(-(-( and what that means, or that * are completed before + (it says ārememberā but I donāt remember being taught that!)
Thereās also no explanation of what weāre actually supposed to write for the answer, as many people have pointed out.
What I would like to know please, is, if you pay for the pro version, do you get this kind of non-scaffolded problem then too, or am I getting this because Iām on the free version? I donāt like to learn like this, where things just come out of the blue with no prior explanation, so I want to know if itās worth paying for the pro version, or if Iām going to face this kind of frustration then too.
Many thanks
We are to evaluate each expression, either in our head or on paper, and then write in the yield, whether True or False.
As for the other math related concerns, operator precedence is usually covered in middle school algebra, or at the very least by grade 10. Some learners depend on a key phrase to help commit it to memory.
BEDMAS
Brackets
Exponents
Division/Multiplication
Addition/Subtraction
This is known as order of operations.
When we see a minus sign in front of something, itās the same as mulitplying that something by negative 1.
-42 == -1 * 42
We could rewrite the expression,
-(-(-(-(2))))
as,
-1 * (-1 * (-1 * (-1 * (2))))
Since it is all multiplication, we donāt even need the brackets.
-1 * -1 * -1 * -1 * 2
When there is an even number of negative signs, the terms (factors, actually) cancel out since negative times negative is positive.
-1 * -1 == 1
-1 * -1 == 1
The end result is 1 * 2 => 2
. If comparing to -2
, then the outcome will be False since -2 != 2
.
i input the Boolean to be true but is giving me error message
Thanks for this explanation. Iāve not done algebra in about 20 years, so I needed this back to basics breakdown. As someone new to coding, I enjoy the logical thinking, but I am not good at maths. Does coding on the whole need a lot of mathematical knowledge?
That would depend. A likely answer. On the whole, we can leverage even a small amount of math into a powerful algorithm. This does not preclude us refining our logic enough to write an algorithm to perform math we didnāt even know about. The thing both programming and math have in common is logic. If we have refined math skills it can easily be transmuted into programming skills, and vice-versa. But neither are a prerequisite to learning. They can both be learned, either together or separately. Stretch oneās mind and we never know what may be the outcome.
Iām enjoying the challenge of relearning at least, and thanks again for the breakdown.
But when you click to view thew solution, the evaluation is not what is shown - what is shown in the text in the question
Well, do we really need to see the solution at this point? Give your head a challenge and work it out. Otherwise there is no point going forward. You need to think for yourself to be a programmer. When you cannot do that, youāre a bit young for this pursuit and need to come back when youāve grown a bit.
Hi - thanks for the reply - however I could (and in the end I did) easily evaluate each, however I found the question wasnāt well written.
The question perhaps could have said something like - write the outcome of your evaluation of each of the following
I have got an answer that is different to yours but itās still showing correct here. can you please confirm whether it is correct or a glitch.
I still do not understand, My math skills are not very sharp at all is there a way to make sense of this or even be able to learn code without having decent math skills?