Menu

Sign in to track your progress and unlock all features.

Theme style

Log in
01. Check Even or OddE02. Determine Positive, Negative, or ZeroE03. Compare Two NumbersE

Problem No 1

Check Even or Odd

Easy

6 minute session

Summary

Determine whether an integer is even or odd using conditional logic.

Problem statement

Given an integer n, determine whether it is even or odd. Implement the function check_even_or_odd(n) that returns the string 'Even' for even numbers and 'Odd' for odd numbers. Use modulus and if-else statements to decide.

Task

Write a function that returns 'Even' if a number is even and 'Odd' if it's odd.

Examples

Example 1

Input

n = 4

Output

Even

Explanation

4 % 2 == 0 so it's Even.

Input format

A single integer n.

Output format

A string: either 'Even' or 'Odd'.

Constraints

n will be a valid integer (can be negative, zero, or positive).

Samples

Sample input 0

2

Sample output 0

Even

Explanation 0

2 is divisible by 2.

Code editor
Loading editor…

AI assistant

Ask me anything!

Need help? I can explain the core idea behind this problem, review your current code, and give targeted hints. Use “Teach Theory” for the concept, “Get AI hint” for a quick scaffold nudge, or ask a specific question below.

Chat history is temporary and will not be saved.

12:41 PM

Free preview includes 1 Teach Theory response and 1 AI hint on each of the first 3 lessons in this module.