# WHILE loops
# Like repeating IFs
# May be infinite (if not done properly)
# General purpose - any loop can be a WHILE loop
# FOR loops
# Counting loops
# For now, we'll execute a "known" number of times
# Later we'll use tuples and lists
# Cannot be infinite
#
# FOR loops
# Generic:
# for ` in range(, [, ]):
# `` is a variable which takes a value in the given range
# is the starting value for ``
# is the ending value for ``
# is the step size (optional - defaults to 1)
# e.g.
# for i in range(0, 10, 2):
# Values for i: 0, 2, 4, 6, 8 (but not 9, and not 10)
sum = 0
for i in range(0, 10, 2):
sum = sum + i
print sum
# Write the code to do the summation on the board
# (previously used a WHILE loop)
Total = 0
for i in range(2, 11):
Total = Total + (i**2 + 3)
print Total
`