Created
July 8, 2020 07:48
-
-
Save Chestermozhao/d9b69f2300761658c9ba4b38d89cc71f to your computer and use it in GitHub Desktop.
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 Pokemon(object): | |
def __init__(self, name, skill, level): | |
self.name = name | |
self.skill = skill | |
self.level = level | |
@property | |
def attack_power(self): | |
return self.level * 100 | |
name = "Pikachu" | |
skill = "thunder" | |
level = 100 | |
Pikachu = Pokemon(name, skill, level) | |
print(Pikachu.attack_power) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment