Lesson guide
What this Python exercise practices
Check Even or Odd is a beginner practice lesson that focuses on functions, parameters, return values. It is designed to be solved in about 6 minutes with examples, starter code, and test feedback.
Prerequisites
- Python variables
- Function parameters
- Return values
Difficulty and time
- Level
- Beginner
- Estimated time
- 6 minutes
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.
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.
Free preview includes 1 Teach Theory response and 1 AI hint per unlocked preview lesson.