Python Range() function
The range() function
You can use the range() function to work with a set of numbers efficiently. The range() function starts at 0 by defalut, and stops one number below the number passed to it. You can use the list() function to efficiently generate a large list of numbers.
You can use the range() function to work with a set of numbers efficiently. The range() function starts at 0 by defalut, and stops one number below the number passed to it. You can use the list() function to efficiently generate a large list of numbers.
#Printing the numbers 0 to 1000 for number in range (1001): print(number) #Printing the number 1 to 1000 for number in range(1, 1001): print(number) #Making a list of numbers from 1 to a million numbers = list(range(1, 1000001))
No comments:
Post a Comment