The program will ask for the number of grade scores to average, it will then loop to accept the given number of grade scores. Once all scores are entered, the program will average the grades by adding up all the grade scores and dividing by the number of scores entered (Note: You will need to add up the grades as you are looping to enter them.) Once the average is calculated, the program will see what letter grade should be assigned to the average based on the scale provided below.
can someone help me create a loop with an accumulator? This is what I have done so far:
Num = int(input("Enter the number of scores: "))
score = int(input("Enter a score: "))
Average = (score/Num)
if (Average >= 93):
print("A")
elif(Average >= 85):
print("B")
elif(Average >= 77):
print("C")
elif(Average >= 69):
print("D")
elif(Average <= 68):
print("F")
I am assuming you write your code in python based on the syntax you give. You could try to make a pseudo code for it first before you actually implementing it.
declaring totalScore = 0
declaring average = 0
declaring score
# input number of lesson will be counted to enter the score
input numOfLesson
# Looping to enter the score of each student to list
for i in range(numOfLesson):
input score
total = total + score
# you got the total score, and what you have to do is to divide it with numOfLesson
# to get the average
average = total / numOfLesson
now you know the step by step on how to do it, what you have to do is to convert it to the code