Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def makeint(varname):
- try:
- int(varname)
- return True
- except ValueError:
- return False
- def report_card():
- classname=[]
- grade=[]
- n=1
- subjectnum=raw_input('How many classes did you take? : ')
- while makeint(subjectnum) !=True :
- subjectnum=raw_input('Pls insert a valid numer : ')
- else:
- subjectnum2=int(subjectnum)
- while subjectnum2 > 0 :
- subjectname = raw_input('What is the name for class'+ str(n) +'? : ')
- classname.append(subjectname)
- subjectgrade=raw_input('What is your grade for this class? : ')
- while makeint(subjectgrade) != True :
- subjectgrade=raw_input('Pls insert a valid numer : ')
- else:
- grade.append(subjectgrade)
- n += 1
- subjectnum2 -= 1
- else:
- pass
- witch = len(classname)
- while witch > 0:
- print str(classname[len(classname)-witch]) + " -- " + str(grade[len(grade)-witch])
- witch -= 1
- else:
- totalgrade=map(int,grade)
- print "Overall GPA : " + str(float(sum(totalgrade))/float(len(totalgrade)))
- report_card()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement