Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read one integer and print even or odd (lowercase).
The modulo operator % gives the remainder after division — the classic tool for this.
Input. One line: an integer (may be negative).
Output. The word even or odd.
Constraints
- Works for negative numbers too.
Examples
Input
4
Output
even
Input
7
Output
odd
Hint
- n % 2 is 0 for even numbers.
- A conditional expression is tidy here: "even" if n % 2 == 0 else "odd".
Show correct code
Peek only after you have tried. You can still Check your own version.
n = int(input())
print("even" if n % 2 == 0 else "odd")
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.