Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
857 B
2
Indexable
Never
while True:
    # Input number of the student
    student_number = int(input("How many students took the test: "))

    # Initialize the value for while loop
    total_score = 0
    count = 1

    # Input every students' score
    while count <= student_number:
        student_score = int(input("Enter their score: "))
        total_score += student_score # Calculate students' total score
        count += 1

    # Calculate the average score
    average_score = total_score / student_number

    # Print the result
    print("The average test score is", int(average_score))

    # Ask for continue or stop
    user_decision = input("Do you want to end program? (Enter no to process a new set of scores): ")
    last_decision = user_decision.lower()

    # Determine continue or stop
    if last_decision == "yes":
        break
    else:
        continue