I am required to make a function that provides a Semester Summary that includes courses taken, credits taken, GPA points, and Semester GPA. I have this first function working
- gpacalc()
However, when I try making the second function
- coursePoints(credit,grade)
Which is supposed to return the "GPA points" of one specific class when you enter the credit of the class and the grade received. This is where I run into issues. It says "gp" isn't defined. I know this is a lot but I think it is probably a simple error. I am probably shadowing my variables, which I still can't quite figure out. If you can help, I appreciate it!
# coursePoints requirement
def coursePoints(credit, grade):
gp = 0.00
totalcredits = 0
totalpoints = 0
# I have lots of if statements here, I deleted them for simplicity.#
gp = round(totalpoints,2)/round(totalcredits)
print("The GPA points of this class is:", round(gp))
coursePoints(3,"b")
gpfromcoursePointsand print the result of the function call?print()line at the end needs to be indented so it's part of the function.