# Review for loop and while loop. # Always trace through your code to make sure there is # no *infinite* loop. print('---- loop practice #1 ----') # Write code the print every other int between 10 and 0 # (thus, do not include 10 and 0) # note: for practice, write in 2 versions: for loop and while loop print('for version ') for i in range(9, 0, -2): print(i) print('while version ') i = 9 while i > 0: print(i) i -= 2 print('---- loop practice #2 ----') # Write code the print every other int from 10 to 0 # (thus, can include 10 and 0) # note: for practice, write in 2 versions: for loop and while loop print('for version ') for i in range(10, -1, -2): print(i) print('while version ') i = 10 while i > -1: print(i) i -= 2 print('---- loop practice #3 ----') # Write code the print every other int from 10 to 0 but exclude 0 # (thus, can include 10, not include 0) # note: for practice, write in 2 versions: for loop and while loop print('for version ') for i in range(10, 0, -2): print(i) print('while version ') i = 10 while i > 0: print(i) i -= 2