Answer to Question #98701 in Python for Tobe

Question #98701
Write a loop to print 10 to 90 inclusive (this means it should include both the 10 and 90), 10 per line.
1
Expert's answer
2019-11-15T10:43:49-0500
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).

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS