Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. For this problem, you will need to create two functions and a program. Read the description of the function and then fill out the

2. For this problem, you will need to create two functions and a program. Read the description of the function and then fill out the function table. After you have done that for both functions, the next step is to write Python code to create each function. After that, read the program requirements and write the Python code to create the program. Then run your program. Once you are sure it is correct, take screen shots of your function code, program code, and output.

a. Function1 Description: The function is named percentCorrect. It receives one parameter from the program that invokes it: a maximum score for the test (maxScore). The function then asks the user to input the students score on the test. It checks to see if the score is between 0 and the maxScore, inclusive. If not, the function prompts the user until it gets a valid score. It then calculates percentCorrect= score/maxScore. It will then invoke the function assignGrade and pass it the value of percentCorrect. When it receives a letter grade back from the function, it will return that value to the program.

b. Fill in the function table for percentCorrect.

c. Function2 Description: This function is named assignGrade. It will assign a letter grade based on the percentCorrect parameter it receives and will return the grade to the function that called it.

d. Fill in the function table for assignGrade

e. Write the code for the function percentCorrect.

f. Write the code for the function assignGrade

g. Program Requirements: The program asks the user to enter the value of maxScore. It then invokes the function percentCorrect and passes it the value of maxScore. It receives a letter grade from the function and prints it.

h. Write the program code.

i. Test your program with valid and invalid scores.

image text in transcribed

image text in transcribed

image text in transcribed

2. For this problem, you will need to create two functions and a program. Read the description of the function and then fill out the function table. After you have done that for both functions, the next step is to write Python code to create each function. After that, read the program requirements and write the Python code to create the program. Then run your program. Once you are sure it is correct, take screen shots of your function code, program code, and output. Function1 Description: The function is named "percentCorrect". It receives one parameter from the program that invokes it: a maximum score for the test (maxScore). The function then asks the user to input the student's score on the test. It checks to see if the score is between 0 and the maxScore, inclusive. If not, the function prompts the user until it gets a valid score. It then calculates percentCorrect- score/maxScore. It will then invoke the function assignGrade and pass it the value of percentCorrect. When it receives a letter grade back from the function, it will return that value to the program. a. b. Fill in the function table for percentCorrect

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions