0

I'm new to python so any help would be appreciated, here is a code i've been working on for calculating gpa, I have to calculate gpa of an inputed number of courses by a user (could be 2-infinte number of courses); btw this is not the whole function but only the part i'm having trouble with, the other part (not shown here) is for g (gradepoint) which changes for example A to 4 but I know how to do it. The inputed number of courses have to be included in a string, for ex;

Enter number of courses:

Enter course 1's mark(in letters like A+):

Enter course 1's weight:

Enter course 2's mark:

....

Enter course 6's mark:

Thank you, btw we are not allowed to use lists, dictionaries, or anything that might be advanced

# Code starts here

```
numbercourses = float(input("Enter number of courses: "))
def calculate_gpa(numbercourses):
coursenumber = 1
while numbercourses > 0:
coursenumber = coursenumber + 1
numbercourses = numbercourses - 1
g = float(input("Enter grade course No. ", coursenumber))
weight = float(input("Enter weight course No. ", coursenumber))
gpa = gpa + round((conversion(g)/weight),2)
return
print ("Your GPA is", gpa)
```