449,054 Members | 1,310 Online
Need help? Post your question and get tips & solutions from a community of 449,054 IT Pros & Developers. It's quick & easy.

# How to calculate GPA using 'while' and calling another function for calculation

 P: 1 What I'm trying to do is to takes amount of subjets, then takes raw score accordingly, and return GPA and this function will call checkGradePoint during GPA calculation. Expand|Select|Wrap|Line Numbers def checkGradePoint(raw): if raw>100:     score = "Error, raw score exceed max score"  elif raw>80:     score = "4" elif raw>70:     score = "3" elif raw>60:     score = "2" elif raw>50:     score = "1" elif raw>0:     score = "0" else:     score = "Error, raw score exceed min score"       def calGPA(n): ''' (int) -> float >>> calGPA(5) raw score: 55 raw score: 56 raw score: 59 raw score: 57 raw score: 61 1.2 >>> calGPA(3) raw score: 74 raw score: 82 raw score: 51 2.67 >>> ''' for i in range(n):     y = input("score?") while n:      totpoints = 0     totunits = 0     while n:           grade = checkGradePoint(raw) This is how far I can go what should I do next? Sep 25 '15 #1