Question: PYTHON: Write a program to prompt for a score between 0 and 100. If the score is out of range, print an error message, else

PYTHON:

Write a program to prompt for a score between 0 and 100. If the score is out of range, print an error message, else use the grading system below.

score >= 90 = A

score >= 80 = B

score >= 70 = C

score >= 60 = D

score < 60 = F

Your program should use a function to determine the letter grade and a loop to allow the user to enter a new score until they decide to stop the program.

SAMPLE OUTPUT Enter a score: 89.9

Grade = B

Continue (y/n): Y

Enter a score: 101

Invalid score

Continue (y/n): y

Enter a score: -1

Invalid score

Continue (y/n): x

Enter y or n: a

Enter y or n: y

Enter a score: 0

Grade = F

Continue (y/n): y

Enter a score: 59.9

Grade = F

Continue (y/n): Y

Enter a score: 60

Grade = D

Continue (y/n): n

End of program

This is what I have so far but i'm still a bit confused. Any help is appreciated!! score = float(input('enter a score:')) resource = "y" if score >= 0 and score <= 59: print('F') elif score >= 60 and score <=69: print('D') elif score >= 70 and score <=79: print('C') elif score >= 80 and score <=89: print('B') elif score >= 90: print('A') else: print("invalid score")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!