# File: for.py
# show different ways to use range or lists in for loops
#
# Matt Bishop, ECS 10, Fall 2012
#
#
# range with 1 number: generate numbers from 0 up to
# but not including that number
#
def forran1():
print("This is for i in range(3):")
for i in range(3):
print(i)
#
# range with 2 numbers: generate numbers from the first up to
# but not including the second
#
def forran2():
print("This is for i in range(-3,3):")
for i in range(-3,3):
print(i)
#
# range with 3 numbers, third one positive: generate numbers
# from the first up to but not including the second, counting
# with step of the third
#
def forran3():
print("This is for i in range(-3, 3, 2):")
for i in range(-3, 3, 2):
print(i)
#
# range with 3 numbers, third one negative: generate numbers
# from the first own to but not including the second, counting
# with step of the third
#
def forran4():
print("This is for i in range(3, -3, -2):")
for i in range(3, -3, -2):
print(i)
#
# range with 3 numbers, third one negative: generate numbers
# from the first own to but not including the second, counting
# with step of the third
#
def forran5():
print("This is for i in range(-3, 3, -2):")
for i in range(-3, 3, -2):
print(i)
# calling them all
def main():
forran1()
forran2()
forran3()
forran4()
forran5()
main()