Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Refactor the following to avoid code clones! The function you create should be called calculate _ course _ grade. 1 # Student 1 Grade Calculation

Refactor the following to avoid code clones!
The function you create should be called calculate_course_grade.
1
# Student 1 Grade Calculation
2
midterm =20.5
3
final =50
4
final_grade = midterm *0.25+ final *0.75
5
6
if final <50 and final_grade >45:
7
final_grade =45
8
9
# Student 2 Grade Calculation
10
midterm =92.8
11
final =100
12
final_grade = midterm *0.25+ final *0.75
13
14
if final <50 and final_grade >45:
15
final_grade =45
16
17
# Student 3 Grade Calculation
18
midterm =2
19
final =13
20
final_grade = midterm *0.25+ final *0.75
21
22
if final <50 and final_grade >45:
23
final_grade =45
24
25
# Student 4 Grade Calculation
26
midterm =95
27
final =32
28
final_grade = midterm *0.25+ final *0.75
29
30
if final <50 and final_grade >45:
31
final_grade =45
32
33
# Student 5 Grade Calculation
34
midterm =64
35
final =95.7
36
final_grade = midterm *0.25+ final *0.75
37
38
if final <50 and final_grade >45:
39
final_grade =45

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Were the participants sensitized by taking a pretest?

Answered: 1 week ago