Range of numbers

Date: March 3rd 2016
Last updated: Feb 3rd 2017

range in python3 gives a sequence of numbers up to by not including the number you give the function.

# range object
range(3)
# range(0, 3)

# print items of range
for i in range(3):
     print(i)
# 0
# 1
# 2

# get range in list form
[x for x in range(3)]
# [0, 1, 2]

results matching ""

    No results matching ""