I was working on a simple project to get me more acquainted with Python since it's been a while and the new semester has started.
import math
count = input('Please enter the number of grades: ')
grade_list = []
while count != 0:
grade = input('What was the grade for the first test?: ')
grade_list.append(grade)
count = int(count) - 1
def mean(x):
grade_total = int(sum(x))
grade_count = int(len(x))
mean = int(grade_total) / int(grade_count)
return mean
print(mean(grade_list))
Here's the error I keep running into:
Traceback (most recent call last):
File "C:\Users\hattd\Documents\Python Projects\miniproject1.py", line 17, in <module>
print(mean(grade_list))
File "C:\Users\hattd\Documents\Python Projects\miniproject1.py", line 12, in mean
grade_total = int(sum(x))
TypeError: unsupported operand type(s) for +: 'int' and 'str'
I thought that turning the variables into integers would stop this from happening? What am I missing here?
