This is the question i was given
---------------------------------------------------
Here is a program that prompts the user to enter a student’s marks, and then prints out whether they have passed or failed a unit.
'''calculate a students grade given their final mark'''
def calcFinal( asg1, asg2, exam ):
final = asg1 + asg2 + exam
return final
def main():
asg1Mark = int(raw_input("Enter Asg1 mark: "))
asg2Mark = int(raw_input("Enter Asg2 mark: "))
examMark = int(raw_input("Enter Exam mark: "))
finalMark = calcFinal(asg1Mark, asg2Mark, examMark)
print "Final mark is %d, grade is" % finalMark,
if finalMark < 50:
print "Fail"
else:
print "Pass"
main()
Modify the program so that it prints out the students grade, assuming standard university cutoffs for the different grades( ie < 50 FAIL, <65 PASS, < 75 CREDIT, < 85 DISTINCTION, and >= 85 HIGH DISTINCTION.
--------------------------------------------------------------------
and this is code ive been working on
'''calculate a students grade given their final mark'''
def calcFinal( asg1, asg2, exam ):
final = asg1 + asg2 + exam
return final
def main():
asg1Mark = int(raw_input("Enter Asg1 mark: "))
asg2Mark = int(raw_input("Enter Asg2 mark: "))
examMark = int(raw_input("Enter Exam mark: "))
finalMark = calcFinal(asg1Mark, asg2Mark, examMark)
print "Final mark is %d, grade is" % finalMark,
if finalMark < 50:
print "Fail"
elif finalMark < 65:
print "Pass"
elif finalMark < 75:
print "credit"
elif finalMark < 85:
print "Distinction"
elif finalMark >= 85:
print "High Distinction"
elif finalMark < 100:
print "High Distinction"
else:
print "Invaild selction"
main()
But its not getting the result i wanted :(
If anyone can point out my mistake or help me out'
please reply