Commit 1e1decb0 by BellCodeEditor

save project

parent 7f4c5f2e
Showing with 8 additions and 5 deletions
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level = 1 self.level = 1
self.hp = 666 self.name = name
self.attack = -200000 self.hp = hp
yuanshu = Hero() self.attack = attack
print("猿树的血量为,",yuanshu.hp) yuanshu = Hero("猿树",500,0.1)
zhugecunfu = Hero("诸葛村夫",666,666)
print("名称:",yuanshu.name,"等级:",yuanshu.level,"血量:",yuanshu.hp,"伤害:",yuanshu.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