Question: Instruction and Problems Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit

Instruction and Problems

Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit the Python files to Blackboard for credit. In this lab, you should submit 4 Python files, one for each problem.

Problem 4

Students in a course need to do lab assignments and take tests. Course grade is calculated from these scores. Write a program to calculate course grade. You must write and use the following two functions.

(A) A main function: First, ask the user how many labs there are. Use a loop to enter lab scores and store them in a list. Display the list of lab scores. Second, ask the user how many tests there are. Use a loop to enter test scores and store them in another list. Display the list of test scores. Third, tell the user that the default weights for labs and tests are 50 and 50. If the user wants to use the default weights, enter D. Otherwise, enter C. If the user chooses to use default weights, call the grade_calculator function and pass the list of lab scores and the list of test scores as two arguments. Do not pass any other arguments. If the user chooses not to use default weights, ask the user to enter the weights for labs and tests, respectively. Then call the grade_calculator function and pass the list of lab scores, the list of test scores, lab weight and test weight as four arguments. You are free to use positional or keyword arguments.

(B) A grade_calculator function: This function has four parameters: lab score list, test score list, lab weight and test weight. Use default arguments for lab weight and test weight. Default values are 50 and 50. First, calculate and display average lab score. Second, calculate and display average test score. Third, use average lab score, average test score, lab weight and test weight to calculate course grade. Display course grade.

The following is an example. Default weights are used.

How many labs? 3

Enter a lab score: 87

Enter a lab score: 93

Enter a lab score: 90

Lab scores: [87.0, 93.0, 90.0]

How many tests? 2

Enter a test score: 85

Enter a test score: 75

Test scores: [85.0, 75.0]

The default weights for course grade are 50% labs and 50% tests.

Enter C to change the weights or D to use default weights: D

Lab average: 90.0

Test average: 80.0

Course grade: 85.0

The following is another example. Default weights are not used.

How many labs? 3

Enter a lab score: 93

Enter a lab score: 87

Enter a lab score: 90

Lab scores: [93.0, 87.0, 90.0]

How many tests? 2

Enter a test score: 85

Enter a test score: 75

Test scores: [85.0, 75.0]

The default weights for course grade are 50% labs and 50% tests.

Enter C to change the weights or D to use default weights: c

Enter lab percentage (without the % sign): 60

Enter test percentage (without the % sign): 40

Lab average: 90.0

Test average: 80.0

Course grade: 86.0

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!