4.6.2 - Example 2: Check Even or Odd
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does num % 2 return if num is an even number?
💡 Hint: Think about division and remainders.
In the Python program we wrote, what function is used to get user input?
💡 Hint: It starts with an 'i' and is short for something.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the modulo operator do?
💡 Hint: Think about how division and remainders work.
If you input 10 into the program, will the output be 'Even'?
💡 Hint: Is 10 divisible by 2 without a remainder?
Get performance evaluation
Challenge Problems
Push your limits with advanced challenges
Write a program that repeatedly asks the user for numbers and stops when the user enters '0'. It should indicate if each number is even or odd.
💡 Hint: Think about how to implement a stopping condition.
Modify the program to count how many even and how many odd numbers have been inputted by the user.
💡 Hint: Consider how to maintain and update counters for even and odd inputs.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.