Question: I'm having trouble obtaining the correct output for the problem below. I am using Python as the programming language. I can display the output but
I'm having trouble obtaining the correct output for the problem below. I am using Python as the programming language. I can display the output but I know it would not produce the same result using different numbers. Please advise.
Problem:
Write an application that uses a while loop to validate 3 test scores.
What is the first test score: 101 Please re-enter a number between 0 and 100 What is the first test score: 100 What is the second test score: 110 Please re-enter a number between 0 and 100 What is the second test score: 99 What is the third test score: 87 With an average score of 95.33%, you are on track for an A in this course.
My program:
test = 0 while test < 3: test_1 = int(input(f'What is the first test score: ')) if test_1 > 100: print(f'Please re-enter a number between 0 and 100') test_1 = int(input(f'What is the first test score: ')) test_2 = int(input(f'What is the second test score: ')) if test_2 > 100: print(f'Please re-enter a number between 0 and 100') test_2 = int(input(f'What is the second test score: ')) test_3 = int(input(f'What is the third test score: ')) avg = (test_1 + test_2 + test_3) / 3 print(f'With an average score of {avg:.2f}% you are on track for an A in this course.') break
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
