I’m at the bitwise operators lessons now but I have a simple question:
mask = 0b1000
desired = input & mask
if desired > 0:
What does the parameter
input do? It doesn’t have any arguments passed to it as far as I’m aware. So how can it compare with the variable
(This is my whole code)
we can pass arguments at function call to the parameter, until the function is called the function isn’t executed, so the parameter (
input) just acts as placeholder
Yes but the function isn’t called anywhere … But the code still returns “on” or “off” … how ?
well, the exercise needs to validate the code, the easiest way to do so is to call the function and compare the returned result. This might cause output in the lesson. Go run on repl.it for example, there will be no output
Ok yeah it makes sense … I always get confused with parameters.