# Program to show different types of for loops # Matt Bishop, January 26, 2012 # for ECS 10 Winter 2012 # this routine has a for loop with range(5) def forran1(): print("This is for i in range(3):") for i in range(3): print(i) # this routine has a for loop with range(-3,3) def forran2(): print("This is for i in range(-3,3):") for i in range(-3,3): print(i) # this routine has a for loop with range(-4, 3, 2) def forran3(): print("This is for i in range(-4, 3, 2):") for i in range(-4, 3, 2): print(i) # this routine has a for loop with range(3, -3, -2) def forran4(): 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() main()