190k views
0 votes
Write a for loop to print the numbers 0, 7, 14, 21 … 77 on one line.

User Linn Htoo
by
9.1k points

1 Answer

5 votes

Answer:

for i in range(0, 78, 7):

print(i, end=' ')

Step-by-step explanation:

That's how you will do in python.

The variable i is used for iterating.

In this loop, range(0, 78, 7) generates a sequence of numbers starting from 0 and increasing by 7 at each step, up to but not including 78.

The end=' ' parameter in the print() function ensures that each number is printed on the same line, separated by a space.

User Minha
by
8.2k points