# Author: James Tam # Version: October 25, 2022 # Learning: illustrating how incorrectly formed for-loops by including an # an equivalent while-loop. print("Before loop") for i in range(1,10,-1): print(i) print("After loop") # The for loop starts at 1, it will decrease by one each time through the loop # But in this case the loop only runs when the loop control is greater than # 10 not less than because the loop control is decremented not incremented. print("\nBefore while") i = 1 while (i > 10): print(i) i = i - 1 print("After loop")