l = [*range(5)] # (*) is unpacking operator. "Intro to Python", p137
print(l)
#[0, 1, 2, 3, 4]
l1 = list(range(5)) # call list __init__
print(l1)
#[0, 1, 2, 3, 4]
l2 = [i for i in range(5)] #list comprehension
print(l2)
# [0, 1, 2, 3, 4]
# range starts with 0
# Then goes till the number excluding it
print(list(range(4))) # Output: [0, 1, 2, 3]
# If we give two numbers, first will be the start (including the number)
# Second will be the end (excluding the number)
print(list(range(1, 4))) # Output: [1, 2, 3]
friends = ['John', 'Mary', 'Martin']
# If we get an integer as an output, we can use it to make a range function
# Here the len function gives us an integer, and we can use it for range function
print(list(range(len(friends)))) # Output: [0, 1, 2]
# Also we can demacate a gap by giving a third number
print(list(range(0, 10, 2))) # Output: [0, 2, 4, 6, 8]