# Examples of for and while loops in Python
# Standard for loop to count to 10
# Note that the range function has an 11 instead of a 10
print('Count to 10')
for i in range(1,11):
print(i)
# Count from 1 to 10 in steps of 2
print('')
print('Count to 10 in steps of 2')
for i in range(1,11,2):
print(i)
# Count from 10 to 1
# again, note that the range function stops at 0 instead of 1
print('')
print('Count from 10 to 1')
for i in range(10,0,-1):
print(i)
#
# NOTE: range(5,1) is empty, so the loop below never executes
print('')
print('Empty loop')
for i in range(5,1):
print(i)
# Note that inputs to range must be integers.
# range(1,3,0.1)
# generates an error
# A while loop that counts to 10
print('')
print('Count from 1 to 10 in a while loop')
i = 1
while (i <= 10):
print(i)
i = i + 1