Commit 0d9901b4 by BellCodeEditor

save project

parent 06510e06
Showing with 18 additions and 10 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def new_yase():
self.name = name def __init__(self):
self.hp = hp self.level=1
self.attack = attack self.hp=300
yase=Hero('亚瑟',300,20) self.attack=20
houyi=Hero('后羿',250,23) yase=Hero(yase.level=level+1)
print(yase.name,houyi.name) yase=Hero(yase.hp=hp+50)
print(yase.hp,houyi.hp) yase=
print(yase.attack,houyi.attack)
\ No newline at end of file # def __init__(self,name,hp,attack):
# self.name = name
# self.hp = hp
# self.attack = attack
# yase=Hero('亚瑟',300,20)
# houyi=Hero('后羿',250,23)
# print(yase.name,houyi.name)
# print(yase.hp,houyi.hp)
# print(yase.attack,houyi.attack)
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