148k views
13 votes
It's common to print a rotating, increasing list of single-digit numbers at the start of a program's output as a visual guide to number the columns of the output to follow. With this in mind, write nested for loops to produce the following output, with each line 60 characters wide: | | | | | | 123456789012345678901234567890123456789012345678901234567890

1 Answer

8 votes

Answer:

The program in python is as follows:

for i in range(0,6):

for i in range(0,9):

print(" ",end='')

print("|",end='')

print()

for i in range(1,61):

print(i%10,end='')

Step-by-step explanation:

See attachment for program output format

The next two instructions create a nested for loop

for i in range(0,6):

for i in range(0,9):

This prints 9 spaces

print(" ",end='')

This prints a vertical line at the top of the end of the spaces printed

print("|",end='')

This prints a new line

print()

This iterates from 1 to 60

for i in range(1,61):

This prints 1, 2, 3....9, then 0, 6 times on a straight line

print(i%10,end='')

It's common to print a rotating, increasing list of single-digit numbers at the start-example-1
User Cervo
by
5.2k points