Question
IN PYTHON 3: Write a for loop that will print the numbers 0 through 9. It will also print zero, even or odd on each
IN PYTHON 3:
Write a for loop that will print the numbers 0 through 9. It will
also print zero, even or odd on each loop, depending on if the number it is printing is
zero, even, or odd. For example, on the first loop, it should print 0 and zero; on the
second loop, it should print 1 and odd; on the third loop, it should print 2 and even.
Use the modulo operator to test if a number is even. The modulo operator in python is %.
The modulo divides one number by the other and returns the remainder. Here are some
examples of using the modulo operator:
Example 1
print(4 % 2) # 0 will be printed because 4 divided by 2 is 2 and the
remainder is 0
Example 2
print(5 % 2) # 1 will be printed because 5 divided by 2 is 2 and the
remainder is 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started