fork download
  1. class Student(object):
  2. def __init__(self, name, score):
  3. self.name = name
  4. self.score = score
  5.  
  6. def get_grade(self):
  7. if self.score >= 90:
  8. return 'A'
  9. elif self.score >= 60:
  10. return 'B'
  11. else:
  12. return 'C'
  13.  
  14. lisa = Student('Lisa', 99)
  15. bart = Student('Bart', 59)
  16. print(lisa.name, lisa.get_grade())
  17. print(bart.name, bart.get_grade())
  18.  
  19. # your code goes here
Success #stdin #stdout 0.1s 14076KB
stdin
Standard input is empty
stdout
Lisa A
Bart C