Question: USING PYTHON PROGRAMMING AND WHILE LOOPS(DO NOT USE FOR LOOPS) Write a program that prompts the user for the number of tests they ve taken

USING PYTHON PROGRAMMING AND WHILE LOOPS(DO NOT USE FOR LOOPS)

Write a program that prompts the

user for the number of tests they

ve taken

,

and then asks for their grade for each test

.

For each test, ask the user

(in this exact order),

I

f

extra credit was allowed

(

yes

or

no

)

on the test.

W

hat their grade was

for the test

.

T

he program must then check the

validity

of the grade, and re

-

prompt if the

entered grade is invalid.

(The program should

not

re

-

prompt

about extra

credit,

only for a new grade

see

sample output for an example.)

I

f extra credit is

not

allowed, the grad

e must be between 0 and 100

If extra credit i

s allowed, the grade must be

0

or higher

Once the user has entered

t

he

information

about all of the

test

s

extra credit

status (

allowed or not), and a valid

s

core

for

e

ach

test

, the program should

print out the highest earned grade before exiting.

The program can assume that the number of tests will be at least one.

Y

ou are

not

requi

red to use a list for this part

of the homework,

but using one

may make certain aspects easier

.

(HINT: Think carefully about what your conditionals should look like. If

necessary, draw a truth table to help figure out what different inputs will do.

Using a Boolean flag will also likel

y make this easier.)

SAMPLE OUTPUT

Enter number of tests taken 5

For Test # 1 was extra credit allowed?

Please enter 'yes' or 'no':

no

Please enter your grade for the test:

-

1

Test grade must be betwe

en 0 and 100 .

Please enter your grade for the test:

101

Test grade must be between 0 and 100 .

Please enter your grade for the test:

100

For T

est # 2 was extra credit allowed?

Please enter 'yes' or 'no':

no

Please enter your grade for the test:

50

For T

es

t # 3 was extra credit allowed?

Please enter 'yes' or 'no':

yes

Please enter your grade for the test:

-

10

Test grade cannot be negative.

Please enter your grade for the test:

10

For T

est # 4 was extra credit allowed?

Please enter 'yes' or 'no':

no

Please e

nter your grade for the test:

9001

Test grade must be between 0 and 100 .

Please enter your grade for the test:

91

For T

est #

5

was extra credit allowed?

Please enter 'yes' or 'no':

y

es

Please e

nter your grade for the test:

1

04

The highest grade received was 104

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!