222k views
1 vote
Write a for loop with a three-parameter range() function that prints the μltiples of 7 between 0 and 100. Print one μltiple per line and avoid printing any numbers that aren't μltiples of 7. Remember that 0 is also a μltiple of 7.

a) True
b) False

User HeroicEric
by
8.6k points

1 Answer

6 votes

Final answer:

To print multiples of 7 between 0 and 100, use a for loop with the range function starting at 0, ending at 101, and stepping by 7. This prints each multiple on a separate line and includes 0, which is also a multiple of 7.

Step-by-step explanation:

To write a for loop with a three-parameter range() function that prints the multiples of 7 between 0 and 100, you can use the following code:

for i in range(0, 101, 7):
print(i)

This loop starts at 0, ends at 100, and increments by 7 each time. By setting the step parameter of the range() function to 7, we ensure that only multiples of 7 are printed. Since the range is from 0 to 101, it includes the last multiple of 7 before 100, without exceeding 100. The statement print(i) will output each multiple on a new line, as requested.

User El Ruso
by
7.2k points