I am attempting to troubleshoot the errors in this code.
The program is supposed to handle as many students as the user indicates are in the class. Receive a letter grade: A, B, C, D, F for each student. Finally it will calculate and display the class average.
My code so far:
students = int(input('How many students: '))
total_sum = 0
for n in range(students):
Letter = input('Enter grades: ')
Letter_int = Letter
if Letter == "A":
Letter_int == int(80)
elif Letter == "B":
Letter_int == int(70)
elif Letter == "C":
Letter_int == int(60)
elif Letter == "D":
Letter_int == int(50)
elif Letter == "F":
Letter_int == int(40)
total_sum += Letter_int
avg = total_sum/students
print('Average of this/these', students, 'student(s) is:', avg)
The code isn't adding the integer value of the letter grades, the sum always returns as 0 or TypeError: unsupported operand type(s) for +=: 'int' and 'str'. I am a python novice and I could use some assistance.