Skip to content

Latest commit

 

History

History
executable file
·
54 lines (37 loc) · 767 Bytes

File metadata and controls

executable file
·
54 lines (37 loc) · 767 Bytes

range()

Examples in Python 3

"""
Simple range of 10
"""
# Notice that it will not include 10, and starts at 0
print(range(10))
print("")


"""
Iterate over range
"""
for x in range(6):
	print(x, end=",")
print("\n")


"""
Change start for range
"""
for x in range(5,10):
	print(x, end=",")
print("\n")


"""
Add step to range
"""
# Only print even numbers
for x in range(0, 10, 2):
	print(x, end=",")
print("")

Reference and read more

The range() Function

range()

Revision history

2014-07-17 (sylvanas) PA1 First try.