```
# This file contains python code that will determine whether a potivie range
# of integers entered by the user will contain odd or even numbers, prime or
# composite numbers, perfect/abundant/deficient numbers, square numbers, and
# triangular numbers.
def main():
import math
firstNum = 0
secondNum = 0
n = 0
odd = 0
prime = 0
perfect = 0
square = 0
perfect = 0
square = 0
triangular = 0
printGreeting()
firstNum = input('Please enter an integer between 1 and 100000: ')
secondNum = input('Please enter an interger greater than your pervious but not larger than 100000: ')
for n in range(firstNum, secondNum + 1):
isOdd(n)
isPrime(n)
checkForPerfect(n)
isSquare(n)
isTriangular(n)
printTablLine(n, odd, prime, perfect, square, triangular)
main()
printGreeting():
print 'This program classifies positive integers as Odd/Even,'
print 'Prime/Composite, Perfect/Abundant/Deficient, Square,'
print 'and Triangular.'
print
print 'You will now get to choose the range of positive intergers'
print 'that you would like to see classified.'
print
def printTableHeading():
def isOdd(n):
if firstNum % 2 == 0:
return False
else:
return True
def isPrime(n):
if n == 2:
return True
for divisor in range(3, int(math.sqrt(n)), 2):
if n % divisor == 0:
return False
return True
def checkForPerfect(n):
sum = 0
if n % == 0:
sum +=
if sum == n:
return 'Perfect'
elif sum > n:
return 'Abundant'
else:
return 'Abundant'
else:
return 'Deficient'
def sumDivisors(n):
# returns the sum of the divisors of n.
def isDivisor(a, b):
# a predicate function that returns True if b is a divisor of a, and False if not.
def isSquare(n):
# returns True if n is a perfect square, False if not.
def isTriangular(n):
# returns True if n is a triangular number, False if not.
def printTableLine(n, odd, prime, perfect, square, triangular):
# prints the information for one number on one line of the table.
```

This is my latest homework, could anyone help me find out the error in my isPrime() function. Also how do I set this up to print my return values, for example for isOdd() true = odd, so how would I get it to print Odd? I just need some direction, using functions and returns is confusing me.

Thanks for any input I'm a complete noob.