Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In most universities, course grades are reported using a letter grade, i.e. A, B, ..., whereas the overall performance is reported using Grade Point
In most universities, course grades are reported using a letter grade, i.e. A, B, ..., whereas the overall performance is reported using Grade Point Average (GPA). First, a number (typically in the range from 0 to 4) is assigned to each letter grade. The GPA is calculated by summing the weighted grade points (credit hours * numerical value of the grades) then dividing by the total amount of credit hours. So, for example suppose, consider the simplified grade scale that assigns letter grades of 'A', 'B', 'C', 'D', and "F", to grade points '4', '3', '2', '1', and '0', respectively. If your grades for Biology (3 credits), Math (4 credits). Computer Science (3 credits), and Physics (2 credits) are 'BBAD, then you GPA will be calculated as (rounded to a decimal digit) (3*3) + (43)+(3*4)+(2+1) 3+4+3+2 (a) Write a Python user-defined function that calculates the GPA on a scale of 0 to 4, as above. That is A = 4, B = 3, C = 2, D = 1, and F = 0. Your function should take two input vectors, 'Grades" containing the letter grades and 'Hours' containing the credit hours for each course in 'Grades'. It should output the GPA. Hint: You can consider using the following Python commands: sum, len, and if-elif-else. GPA 2.9 (b) Suppose your grades for a term are as stated in the example above. That is they are ['B', 'B', 'A', 'D'] for Biology (3 credits), Math (4 credits), Computer Science (3 credits), and Physics (2 credits). Your program should create two lists, one for the grades and one for their corresponding hours. It should then use your user-defined function from part (a) to calculate and display the resulting GPA. Important: You have to do this problem in Python. You will not receive any credit if you do this problem in Matlab. In your report, include your Python .py script file that should include your function file (with sufficient comments).
Step by Step Solution
★★★★★
3.53 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
Question Answer Here below is the code for the given question in Python Programming Language Create ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started