1for n in range(2, 10):
2 for x in range(2, n):
3 if n % x == 0:
4 print( n, 'equals', x, '*', n/x)
5 break
6 else:
7 # loop fell through without finding a factor
8 print(n, 'is a prime number')
9
1list = [99, 98, 97, 96, 95, 94]
2
3for number in list:
4 if number == 2:
5 print("There is a 2 in the list")
6 break
7else:
8 print("There are no 2's in the list")
9
10# The else statement is only reached if the for loop
11# has run all the way through without breaking
1numbers = [2, 4, 6, 8, 1]
2for number in numbers:
3 if number % 2 == 1:
4 print(number)
5 break
6else:
7 print("No odd numbers")