Commit ef1e628a by BellCodeEditor

save project

parent 3bddb295
Showing with 13 additions and 5 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attack):
self.leval=1 self.leval=1
self.hp=300 self.name=name
self.attack=20 self.hp=hp
yase=Hero() self.attack=attack
print(yase.hp) yase=Hero("亚瑟",10000,1000)
libai=Hero("李白",5000,4000)
simayi=Hero("司马懿",3000,5000)
liushan=Hero("刘禅",15000,2000)
print("亚瑟的血量为:",yase.hp)
print("李白的血量为:",libai.hp)
print("司马懿的血量为:",simayi.hp)
print("刘禅的血量为:",liushan.hp)
\ 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