Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using a for-loop structure, write a program that would print the numbers from 1

ID: 3908669 • Letter: U

Question

Using a for-loop structure, write a program that would print the numbers from 1 to 100. Every 10 numbers should appear in a separate line. Make the numbers left-adjusted and each occupying a space of five digits.

Using a for-loop structure, write a program that would print the numbers from 1 to 100. Every 10 numbers should appear in a separate line. Make the numbers left-adjusted and each occupying a space of five digits. 1 2 34567 8 910 11 12 13 14 15 16 17 18 19 20 21 22 23 2425 26 27 28 29 30 31 32 333435 36 37 3839 40 1 42 43 4445 46 47 484950 51 52 535455 56 57 58 59 60 61 62 63 665 66 67 68 6970 71 72 73 74 75 76 7778 79 80 81 82 83885 86 87 8889 90 91 92 939495 96 97 9899 100

Explanation / Answer

from math import *
for num in range(1,101):
   print(" ",num,end='')
   if(num%10==0):
       print()

Output:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100

Do ask if any doubt. Please upvote.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote