[Tutor] REport Card Question

Andre Jeyarajan andrejeyarajan at rogers.com
Mon Nov 29 01:50:21 CET 2010


Write a code that will take an input from a user (numerical grade) and convert their numerical grade into a letter grade that is accompanied by a “smart” statement. def grade_score(grade):
    if grade >=95 and grade <= 100: 
        print 'A+, Excellent' 
    elif grade >=85 and grade < 95:
        print 'A, Good Work'
    elif grade >=80 and grade < 85:
        print 'A-, Good Work, but you could do better'
    elif grade >=75 and grade < 80:
        print 'B, Try Harder'
    elif grade >=70 and grade < 75:
        print 'B-, Try Harder'
    elif grade >=65 and grade < 70: 
        print 'C, Work Harder'
    elif grade >=60 and grade < 65:
        print 'C-, Work Harder' 
    elif grade >=55 and grade < 60:
        print 'D, Study Harder'
    elif grade >=50 and grade < 55:
        print 'D-, Study Harder'
    elif grade >=0 and grade < 50:
        print 'F, You Failed'
    else: 
        print "You did not enter an appropriate value, please run the program again!" 


grade = raw_input('Put your grade here:’)


grade_score()
Put your grade here:77
Traceback (most recent call last):
  File "/Users/andre.jeyarajan/Documents/workspace/Chapter 5 Problems/src/ReportCardQuestion.py", line 28, in <module>
    grade_score()
TypeError: grade_score() takes exactly 1 argument (0 given)
Can you help and tell me why it doesn’t work?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101128/7568d5f3/attachment-0001.html>


More information about the Tutor mailing list