Commit 3ddc013c by BellCodeEditor

save project

parent 05995422
Showing with 6 additions and 7 deletions
......@@ -4,13 +4,11 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def levelup(name):
name.level+=1
name.hp*=1.2
name.attack+=20
def levelup(self):
self.level+=1
self.hp*=1.3
self.attack+=20
dream=Hero("dream",300,100)
levelup()
dream.levelup()
print(dream.hp)
print(dream.attack)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment