python print numbers 1 to 10 code example
Example 1: how to print numbers from 1 to 20 in python
for i in range(1, 21):
print(i)
Example 2: print numbers from 1 to 100 in python
# range(a,b,s) allows you to iterate from a to the closest number
# before b (excluded) with step s (default s=1)
# a,b,s are integers
for i in range(1, 101):
print(1, end = ' ') # prints 1 2 3 ... 99 100