Question #98701

Write a loop to print 10 to 90 inclusive (this means it should include both the 10 and 90), 10 per line.

Expert's answer

c = 0
i = 10
while i < 91 and c < 10:
    if c < 9:
        print(i, end=' ')
        c += 1
    else:
        print(i)
        c = 0
    i += 1

In the last line will be one digit - 90, because in the range 10-90 (inclusive both 10 and 90) there are 81 digits (not divisible by 10 without reminder).

LATEST TUTORIALS
APPROVED BY CLIENTS