Write a custom function with the definition def


Problem

Score as its parameter and returns a grade as a string.

Score

Grade

> 0.9

A

> 0.8

B

> 0.7

C

> 0.6

D


F

1. Write a custom function with the definition def computegrade():

2. The function should compute the grade using the score variable based on the table above. You can use if-elif statements to accomplish this

3. Ensure your function has a "return" statement to return the computed grade back to the calling program

4. Once the function is defined, proceed to writing the part of the program that takes in user input for score.

5. Validate that the score is numeric within a try-except block.

6. Invoke the above-defined computegrade function with the user-supplied score. Ensure you capture the return value within your program into a variable placeholder, or else use the print statement to print the return value directly

7. Be sure to comment your program adequately!

8. Remember your Python code will be graded according to our class Rubric.

9. Submit your Python code file. Name it "XXXX-score-function.py" where XXXX is your name.

10. Submit also a Word document showing screen shots of the various testing conditions. Good programmers test all cases, so you should make sure you show tests for each possible grade level (A through F) plus error messages.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a custom function with the definition def
Reference No:- TGS02712746

Expected delivery within 24 Hours