Ask Question
27 August, 20:56

Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue accepting scores until the user enters a negative value. Finally, calculate and display the average for the entered scores.

+2
Answers (1)
  1. 27 August, 23:18
    0
    total = 0

    count = 0

    while (True):

    grade = float (input ("Enter a grade: "))

    if grade < 0:

    break

    else:

    total + = grade

    count + = 1

    average = total/count

    print ("The average is: " + str (average))

    Explanation:

    *The code is in Python.

    Initialize the total and count as 0

    Create a while loop that iterates until a specific condition is met inside the loop

    Inside the loop, ask the user to enter a grade. If the grade is smaller than 0, stop the loop. Otherwise, add the grade to the total and increment the count by 1.

    When the loop is done, calculate the average, divide the total by count, and print it
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue accepting ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers