Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does num % 2 return if num is an even number?
Think about division and remainders.
In the Python program we wrote, what function is used to get user input?
It starts with an 'i' and is short for something.
What does the modulo operator do?
Think about how division and remainders work.
If you input 10 into the program, will the output be 'Even'?
Is 10 divisible by 2 without a remainder?
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.
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.
Consider how to maintain and update counters for even and odd inputs.
3 more questions in this section. Enroll free to practise them all.
Enroll free