Commit cf5b9e26 by BellCodeEditor

save project

parent 5bc6d0fb
Showing with 41 additions and 10 deletions
...@@ -4,7 +4,7 @@ class Hero: ...@@ -4,7 +4,7 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
hy=Hero('hy',250,23) hy=Hero('hy',250,23)
k=Hero('K',5600,199) k=Hero('K',5600,199)
print(yase.attack) print(yase.attack)
......
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero('yase',300,20)
yase.upgrade()
print('垭瑟的血量为'+str(yase.hp))
\ No newline at end of file
class i: class cat:
def __init__(self,eye,foot,skin): def __init__(self,eye,foot):
self.yanjing=eye self.eye=eye
self.jian=foot self.foot=foot
self.pifu=skin def upgrade(self):
self.eye=self.eye+2
dou=i(2,2,"yellow") self.foot=self.foot+4
print(dou.jian) cat=cat(0,0)
\ No newline at end of file cat.upgrade()
print('猫的脚'+str(cat.foot))
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