Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class Student:
  2. def __init__(self, score=10):
  3. self.score = score
  4.  
  5. def __str__(self):
  6. return str(self.score)
  7.  
  8. def add_score(self):
  9. self.score += 10
  10.  
  11. def decrease_score(self):
  12. self.score -= 10
  13.  
  14. p = Student()
  15.  
  16. print(p)
  17. 10
  18.  
  19. p.add_score()
  20.  
  21. print(p)
  22. 20
  23.  
  24. p.decrease_score()
  25.  
  26. print(p)
  27. 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement