4. For the following problem submit a photo of the flowchart and shots of your P
ID: 3755681 • Letter: 4
Question
4. For the following problem submit a photo of the flowchart and shots of your Python screens showing the program code and the output. Your task is to input from the teacher the test score of each student and to output the highest score. You need to check each score to make sure it is valid (at least 0 and at most 100). If it is not valid, keep prompting for a valid score until you get one. After a valid score is input process it, and then ask the teacher if she has another score to enter When you run the program, test the logic when the score entered is invalid when it is a valid score, and when the teacher says she has no more scores to enterExplanation / Answer
Here is the code in Python
--------------------------------------------------------------------
highest_number=0
while True:
ask=input("Do you want to enter a score (Y/N)?:")
if ask=='N':
break
else:
while True:
score = input("Please enter a score between 1 and 100 :")
if (score.isnumeric() and int(score)>=0 and int(score)<=100):
if highest_number<int(score):
highest_number=int(score)
break
print("Highest Number",highest_number)
Here is the output
----------------------------------------------------------------------------
Do you want to enter a score (Y/N)?:Y
Please enter a score between 1 and 100 :99
Do you want to enter a score (Y/N)?:Y
Please enter a score between 1 and 100 :-9
Please enter a score between 1 and 100 :88
Do you want to enter a score (Y/N)?:Y
Please enter a score between 1 and 100 :111
Please enter a score between 1 and 100 :100
Do you want to enter a score (Y/N)?:Y
Please enter a score between 1 and 100 :0
Do you want to enter a score (Y/N)?:Y
Please enter a score between 1 and 100 :88
Do you want to enter a score (Y/N)?:N
Highest Number 100
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.