Last active
October 2, 2017 01:48
-
-
Save SpikeXy/a891d92994fbceca4ce15e4882edc4cc to your computer and use it in GitHub Desktop.
get_score set_score #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student(object): | |
def get_score(self): | |
return self._score | |
def set_score(self, value): | |
if not isinstance(value, int): | |
raise ValueError('score must be an integer!') | |
if value < 0 or value > 100: | |
raise ValueError('score must between 0 ~ 100!') | |
self._score = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment