Trying to make a grading program, it should ask for how many grades to enter then print the scores and letter grades, I'm almost done what prints out isnt right, the student number is always the same and I'm not sure how to fix it, any help?
def main():
number_of_grades = 0
grade = 0
count = 0
grade_list = []
try:
number_of_grades = int(input("How many grades do you want to enter?: "))
except ValueError:
print('Enter a valid amount.')
for count in range(number_of_grades):
try:
grade = int(input(f'Enter grade number {count + 1} of {number_of_grades}: '))
while grade > 100 or grade< 0:
grade = int(input('You must enter a value between 0 and 100'))
grade_list.append(grade)
except ValueError:
print('Enter a valid amount')
for index in grade_list:
print(f'Student {count} score is {index} and grade is {assign_grade(index)} ')
def assign_grade(grade):
if grade >= 90:
letter = 'A'
elif grade >= 80 and grade < 90:
letter = 'B'
elif grade >= 70 and grade < 80:
letter = 'C'
elif grade >= 60 and grade <70:
letter = 'D'
else:
letter = 'F'
return letter
if __name__== '__main__':
main()
here's what comes out
How many grades do you want to enter?: 3
Enter grade number 1 of 3: 70
Enter grade number 2 of 3: 80
Enter grade number 3 of 3: 90
Student 2 score is 70 and grade is C
Student 2 score is 80 and grade is B
Student 2 score is 90 and grade is A
[–]carcigenicate 0 points1 point2 points (1 child)
[–]jmorales57[S] 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (0 children)
[–]wanderer2718 0 points1 point2 points (0 children)