Advertisement
FelipeNeto2

Poo (Python)

Dec 13th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. class Student:
  2.   def __init__(self, name, year):
  3.     self.name = name
  4.     self.year = year
  5.     self.grades = []
  6.  
  7.   def add_grade(self, grade):
  8.     if type(grade) is Grade:
  9.       self.grades.append(grade)      
  10.  
  11. class Grade:
  12.   minimum_passing = 65
  13.  
  14.   def __init__(self, score):
  15.     self.score = score
  16.    
  17. roger = Student("Roger van der Weyden", 10)
  18. sandro = Student("Sandro Botticelli", 12)
  19. pieter = Student("Pieter Bruegel the Elder", 8)
  20. pieter.add_grade(Grade(100))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement