'How to check for the highest score in the middle of the program

The program determines who has the highest score at the end, but I am trying to incorporate a function to print who has the highest grade as the scores are being input?

#Creating function for student names and weights:
def overall_grade(student):
    # inputs for each category:
    dis_grade = float(input(f"{student}'s discussion score:"))
    quiz_grade = float(input(f"{student}'s quiz score:"))
    assign_grade = float(input(f"{student}'s assignment score:"))
    #weights for each category of discussion(d), quiz(q), and assignment(a):
    d_wt = 0.25
    q_wt = 0.35
    a_wt = 0.40     
    #returning average with weights incorporated:
    average = (d_wt * dis_grade) + (q_wt * quiz_grade) + (a_wt * assign_grade)
    return average

#creating main function to display student with highest grade:
def main():
    #The list of names for the students:
    students = ["Logan", "Raymone", "Timothy", "Kim"]
    #Assigning starting variable for grades:
    best_grade = 0
    top_student = ""
    #setting range to the scores for each student to give total score:
    for x in range(len(students)):
        total = overall_grade(students[x])
        print(f"{students[x]} total score: {total:.2f}")
        #I assume this is where the "if" statement starts for the checks
        if x == 0 or best_grade < total:
            best_grade = total
            top_student = students[x]
    print(f"Student with the best grade is {top_student} with a total percentage of: {best_grade:.2f}%" )
    
main()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source