PDA

View Full Version : Python how to print 1 to 100 numbers



Saarh
04-20-2017, 09:28 AM
Using Python how to print 1 to 100 numbers. I have tried this with an example like count = count + 3 but i get an infinite loops going continuously. Please help to solve it.

Yokesh
04-20-2017, 09:36 AM
Actually, it is very easy to print a loop of numbers in python. (https://www.egrovesys.com/python-development-services/) It is similar to a c program. I will help to solve it.

def printfunction(count):
for count in 101:
print(count)
count=count+1;
But if u use count=count+3 or count+9 it will go continuously because you would have used while loop like while count != 100. Here the loop never ends because the number never becomes equal, so it runs continuously. You can try this result. Python generally is very easy to learn for web development applications (https://www.egrovesys.com/python-development-services/).

programmers.io
02-21-2022, 11:58 AM
# Python program to print numbers from 1 to 100

print('Numbers from 1 to 100:')
for n in range(1, 101):
print(n, end=' ')

If you are looking for Python Development Service (https://programmers.io/python/)? Programmers.io has an experienced Python development team with 8+ years of experience at reasonable rates.