Answer to Question #263544 in Python for Peaches

Question #263544

Write a program to calculate the average of

all scores entered between 0 and 100. Use a

sentinel-controlled loop variable to terminate the

loop. After values are entered and the average

calculated, test the average to determine whether

an A, B, C, D, or F should be recorded.



1
Expert's answer
2021-11-09T12:16:41-0500
sumScore=0
totalScores=0
score=0
while score != -1:
    score = int(input( "Enter a score [0-100], (enter -1 to STOP): " ))
    if score>=0 and score<=100:
        sumScore+=score
        totalScores+=1
average=sumScore/totalScores


if average>=90 and average<=100:
    print("A")
elif average>=80 and average<90:
    print("B")
elif average>=70 and average<80:
    print("C")
elif average>=60 and average<70:
    print("D")
else:
    print("F")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS