Commit 87b13791 by BellCodeEditor

save project

parent 70850cf8
Showing with 29 additions and 0 deletions
class Hero:
def __init__(self,hp,attack):
self.level=1
self.hp=hp
self.attack=attack
def up(self):
self.level+=1
self.hp+=20
self.attack+=12
a=Hero()
b=Hero()
a.hp=100
a.attack=10
b.hp=200
b.attack=5
print(a.attack)
print(a.hp)
print(a.level)
Hero.up(a)
print(a.attack)
print(a.hp)
print(a.level)
print(b.attack)
print(b.hp)
print(b.level)
Hero.up(b)
print(b.attack)
print(b.hp)
print(b.level)
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