Commit 4640d59c by BellCodeEditor

save project

parent 22354288
Showing with 45 additions and 0 deletions
class Helo:
def __init__(selp,name,hp,attack):
selp.level=1
selp.hp=hp
selp.attach=attack
def zengjia(selp):
selp.level=selp.level+1
selp.hp=selp.hp+500
selp.attach=selp.attach+20
hantian=Helo('寒天',3000,999)
zuanfeng=Helo('钻风',2400,2000)
yunying=Helo('云影',1000,500)
# print(hantian.hp)
# print(zuanfeng.hp)
# print(yunying.hp)
# print(hantian.attach)
# print(zuanfeng.attach)
# print(yunying.attach)
Helo.zengjia(hantian)
Helo.zengjia(zuanfeng)
Helo.zengjia(yunying)
print(hantian.hp)
print(zuanfeng.hp)
print(yunying.hp)
print(hantian.attach)
print(zuanfeng.attach)
print(yunying.attach)
print(hantian.level)
print(zuanfeng.level)
print(yunying.level)
\ No newline at end of file
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
yase=Hero('yase',300,20)
hy=Hero('hy',250,23)
k=Hero('K',5600,199)
print(yase.attack)
print(hy.attack)
print(k.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