print from 1 to n in python 1

print from 1 to n in python

#To print a number from 1 to n (n being any number you want + 1, since python wont print the ranged number)
for i in range(1,n):

Here is what the above code is Doing:
1. We are creating a variable called i and setting it to 1.
2. We are creating a for loop that will run until i is equal to n.
3. We are printing the value of i.
4. We are incrementing the value of i by 1.

Similar Posts