I have a dictionary of names of students and their grades. I need to calculate the percentage of these grades and it's weight ( (grade/point)*100 ) and then update their values with the new grades.
I have the following code but the problem is that when I print the dictionary it gives me the old numbers. How can I change the values of the dictionary into the ones after I made the calculations?
maxx = 50
perecent = 100
grades = {'a':36, 'b':25, 'c':43}
for u in grades.values():
w = ((u/maxx)*(perecent))
print(w)
print(grades)
The output of this is:
72
86
50
{'a': 36, 'c': 43, 'b': 25}
while I need:
72
86
50
{'a': 72, 'c': 86, 'b': 50}