- Code: Select all
`# Score Averaging`

while 1==1:

print("Welcome to the Grade Averager!")

print("To average all entered grades, type -1")

# Get class size

size = raw_input("How many students: ")

# Define variables

total=0

average=""

grade=0

# start user input

while grade !=-1:

print("Current point total:"),total

grade = input("Enter grade: ")

total = total + grade

#average grades

print("Calculating your average...")

average = (total/size)

print("Your grade average is: "), average

I don't know enough yet to figure out how to make it loop a SPECIFIC number of times (each time being the number of students), so instead I left it up to the user to make the cutoff. I tried using a variable "x", but it kept getting screwy, and I finally ended up picking -1 (because how the hell are you going to get a negative score??)

I also could not "figure out" how to assign a variable for average, so I though "" would suffice...

The only problem that I keep hitting is on the line:

- Code: Select all
`average = (total/size)`

keeps giving me problems

The python shell comes back saying that with for that line:

"TypeError: unsupported operand type(s) for /: 'int' and 'str' "

Keep in mind, I just started learning python, so I'm sure there's a whole lot "wrong" with what I have so far. Any feedback on the error I'm getting would be greatly appreciated.