Мне нужна помощь по вопросу кодирования в Python.
Я должен рассчитать средний балл студента.Программа должна спросить их, сколько классов они посещают, затем попросить их ввести оценки для каждого класса, и если он будет взвешенным.
Затем программа должна вывести усредненный средний балл, включая десятичное место, и мой основнойПрограмма должна вызвать функцию.
В этом вопросе приводится диаграмма для невзвешенных и взвешенных числовых баллов, которая коррелирует с данной буквенной оценкой: gpa chart
Вот что у меня так далеко:
def average (c):
div = c
avg =(1.0*(sum(scores))/div)
#****************MAIN********************
c = input("How many classes are you taking?")
print ("You are taking " + str(c) + " classes.")
x = input("Enter your letter grade.")
w = int(input("Is it weighted? (1 = yes)")
while (c <= 7): #Here it is saying that there is a syntax error because I input a while loop. I don't know why it is saying this.
if (x == A):
if (w == 1):
print ("Your GPA score is 5")
else:
print ("Your GPA score is 4")
elif (x == B):
if (w == 1):
print ("Your GPA score is 4")
else:
print ("Your GPA score is 3")
elif (x == C):
if (w == 1):
print ("Your GPA score is 3")
else:
print ("Your GPA score is 2")
elif (x == D):
if (w == 1):
print ("Your GPA score is 2")
else:
print ("Your GPA score is 1")
elif (x == F):
if ( w == 1):
print ("Your GPA score is 1")
else:
print ("Your GPA score is 0")
scores = []
list.append(x)
average(c)
Любая помощь будет высоко ценится!:)