i get this error when i get to a certain part in the program

Traceback (most recent call last):
  File "C:/Users/Family/Desktop/13.py", line 54, in <module>
    main()
  File "C:/Users/Family/Desktop/13.py", line 10, in main
    averageScores = getAverage(totalScores, averageScores, number)
  File "C:/Users/Family/Desktop/13.py", line 46, in getAverage
    averageScores = totalScores / number
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'

heres the code

def main():
    endProgram = 'no'
    print
    while endProgram == 'no':
        totalScores = 0
        averageScores = 0
        number = 0
        number = getNumber(number)
        totalScores = getScores(totalScores, number)
        averageScores = getAverage(totalScores, averageScores, number)
        printAverage(averageScores)

        endProgram = raw_input('Do you want to end program? (Enter yes or no): ')
        while not(endProgram == 'yes' or endProgram == 'no'):
            print'Please enter a yes or no'
            endProgram = raw_input('Do you want to end program? (Enter no to process a new set of scores): ')




#this function will determine how many students took the test
def getNumber(number):

    number = input('Enter a number between 2 and 30: ')
    while number <=2 or number >=30:
        print'You must enter a number between 2 and 30'
        number = input('Enter a number between 2 and 30:')

    return number    

#this function will get the total scores
def getScores(totalScores, number):
    for counter in range(0, number):
        score = input('Enter their score: ')
    while score<=10 or score>=100:
        print'You must enter a number between 0 and 100'
        score = input('Enter a number between 0 and 100:')


        totalScores = totalScores + score
        return totalScores, number


#this function will calculate the average
def getAverage(totalScores, averageScores, number):
    averageScores = totalScores / number
    return averageScores

#this function will display the average
def printAverage(averageScores):
    print 'The average test score is', averageScores  

# calls main
main()

Please don't post 54 lines of untested crap here and ask up to clean up your mess. Test each function individually. For example: What happens when you enter 2 students here:

def getNumber(number):
 
    number = input('Enter a number between 2 and 30: ')
    while number <=2 or number >=30:
        print'You must enter a number between 2 and 30'
        number = input('Enter a number between 2 and 30:')
 
    return number

What does this function return if I have already defined 5 students and enter "20" 5 times. It should return 20X5=100. I do not see why you want to return "number" as well.

#this function will get the total scores
def getScores(totalScores, number):
    for counter in range(0, number):
        score = input('Enter their score: ')
    while score<=10 or score>=100:
        print'You must enter a number between 0 and 100'
        score = input('Enter a number between 0 and 100:')
 
 
        totalScores = totalScores + score
        return totalScores, number 
#
# To test this you would call it and print the results
print getScores(0, 5)

Also to clean it up a bit, you do not have to pass averageScores to this function because it is calculated and returned by the function.

#this function will calculate the average
def getAverage(totalScores, averageScores, number):
    averageScores = totalScores / number
    return averageScores

Please test the code first so you don't waste our time or you will find that no one wants to answer your question.

dmurder got his homework everywhere....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.