counter = 0 # counter is the loop counter while counter < 10: print(counter) counter += 1 i = 0 # Now we're calling the loop counter i! while i < 10: print(i) i += 1 # This calculates what I drew on the board i = 0 total = 0 # This is called an accumulator while i < 10: total += i i += 1 print(total) # Counting for loop in Python for i in range(0, 10): print(i) # With named parts initial = 0 condition_end = 10 iteration = 1 for i in range(initial, condition_end, iteration): print(i) print("sum of list is next") # Get the sum of a list! our_list = [3, 5, 8, 0, 10] # We could just do sum(our_list) total = 0 # This is the accumulator # NOT the loop counter for item in our_list: total += item print(total) print() total = 0 for i in range(5, 16, 1): total += i**2 print(total) print() total = 1 for i in range(1, 10, 1): total *= i print(total) print() outer_total = 0 for i in range(0, 5): # Inner sum from here inner_total = 0 for j in range(i, 10): inner_total += i*j # To here outer_total += inner_total print(outer_total)