Commit b7093e5d by BellCodeEditor

save project

parent 3a20df82
Showing with 15 additions and 4 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,a,b,c):
self.level=1 self.level=1
self.hp=300 self.hp=b
self.attack=20 self.attack=c
yase=Hero() self.name=a
yase=Hero("亚瑟",400,200)
houyi=Hero("后意",2000,50)
def upgrade():
yase.level+=1
yase.hp+=50
yase.attack+=20
upgrade()
print(yase.hp) print(yase.hp)
print(houyi.attack)
print(yase.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