Course Content
Introduction to Python
Introduction to Python
Challenge: Creating Odd and Even Logic
Let's tackle another practice task!
Swipe to start coding
You are given the variables num
and result
. Using if/else
, assign the value to the variable result
:
- If
num
is odd, assign the string'odd'
. - If
num
is even, assign the string'even'
.
Tip: A number is considered even if, when divided by 2
, the remainder (using the %
operator) is 0
.
Note
In Python, the
%
operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example,5 % 2
would return1
, since 2 goes into 5 twice with a remainder of 1.

Solution
Thanks for your feedback!
Challenge: Creating Odd and Even Logic
Let's tackle another practice task!
Swipe to start coding
You are given the variables num
and result
. Using if/else
, assign the value to the variable result
:
- If
num
is odd, assign the string'odd'
. - If
num
is even, assign the string'even'
.
Tip: A number is considered even if, when divided by 2
, the remainder (using the %
operator) is 0
.
Note
In Python, the
%
operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example,5 % 2
would return1
, since 2 goes into 5 twice with a remainder of 1.

Solution
Thanks for your feedback!