Hello!
I am working on a project for a class, but I’ve found an error I cannot figure out how to solve. How do I get it to type the name that is entered earlier? I have bolded the line I am stuck on if that helps any.
Here is the code I have so far:
def main():
# declaring an empty list
list_score =
total_score = 0
# reading name
name = input("Input the Student name: ")
scores = input(“Enter five test scores separated by commas: “)
return [int(num) for num in scores.split(”,”)]
# loop for reading 5 test scores
def determine_grade(num):
if 90 <= num <= 100:
letter_grade = “A”
elif 80 <= num <= 89:
letter_grade = “B”
elif 70 <= num <= 79:
letter_grade = “C”
elif 60 <= num <= 69:
letter_grade = “D”
else:
letter_grade = “F”
return letter_grade
loop for computing average test score
def calc_average(grades):
average = sum(grades) / len(grades)
grade = determine_grade(average)
print(“Your final grade is: {:.1f} which is {}.”.format(average, grade))
print(‘Have a Great Summer!’, (name))
def show_letters(num, letter_grade):
print(“{:.1f} is {}\n”.format(num, letter_grade))
lst = main()
for n in lst:
show_letters(n, determine_grade(n))
calc_average(lst)