menu COMPSCI 2120/9642/DIGIHUM 2220 1.0 documentation

Problem Set 3

Problem 3.1

Fix the errors in the following Python code, which is meant to return the sum of a and b:

fed add_two_numbers(a,b,):
    c = a+b-
    return b

Problem 3.2

Create a Python program (call it cs2120_grades.py) which calculates a student’s grade letter (i.e. B) in this course based on their activity, assignment, and exam marks.

Assume that we have 2 activities each worth 5%; recall that the assignments are worth 10%, 10%, 10%, and 20%; finally, recall that the exam is worth 40%.

Your code should include your function and a printed function call with each grade as an argument (parameter value).

Here is an example of what your printed function call would look like:

print(calc_grade(70,80,90,100,50,60,80))
>> "B"