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
Get step-by-step solutions from verified subject matter experts
