Week 5 Unit 3: Exercise
22. October 2024
Implement the function is_even(number)
which gets an integer as input parameter and checks, if this input is even or not. is_even()
will return the boolean value True
if the value is even and False
if the input is not even.
Implement a for
loop which iterates over the range(100)
. Within the for
loop, the sequence-variable is checked with the function is_even()
. Depending on the return value, either x is even
or x is not even
is printed.
Example output:
0 is even
1 is not even
2 is even
...