Using python, write the program below.
Program Specifications:
You are to write the source code and design tool for the following specification:
A student enters an assignment score (as a floating-point value). The assignment score must be between 0 and 100. The program will enforce the domain of an assignment score.
Once the score has been validated, the program will display the score followed by the appropriate letter grade (assume a 10-point grading scale). The score will be displayed as a floating-point number with one value to the right of the decimal point.
Score 89.9 Grade B
Score 77.3 Grade C
Once a score has been processed, the program will ask the user if he or she wishes to enter another grade. The program will continue entering grades until the user chooses to stop. Once the user selects stop, the program will display the following:
Highest Assignment Score entered: 99.9 #99.9 is a placeholder value the represents the users input#
Lowest Assignment Score entered: 99.9
Average Assignment Score………..: 99.9
Submission Requirements:
YOU CANNOT:
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You.
askGradeAndPrint.py
def getScore():
score = float(input("Enter score : "))
while(score<=0 or score>100):
score = float(input("Error !!! Please enter score in range 0-100 :
"))
return score
def getGrade(score):
if score>=90:
return ('A')
elif score>=80:
return ('B')
elif score>=70:
return ('C')
elif score>=60:
return ('D')
else:
return ('F')
highscore=-999
lowscore = 999
count = 0
total = 0
print("Enter grades below or enter negative value to
exit....")
while True:
score = getScore()
print("Score %.3f%15s %c"%(score,"Grade",getGrade(score)))
if highscore<score:
highscore=score
if lowscore>score:
lowscore=score
total += score
count+=1
choice = input("Would you like to continue [y/n] ? ");
if(choice[0]!='y' and choice[0]!='Y'):
break
print("Highest Assignment Score entered : ",highscore)
print("Lowest Assignment Score entered : ",lowscore)
print("Average Assignment Score : ",total/count)
Get Answers For Free
Most questions answered within 1 hours.