Commit 1d633e15 by BellCodeEditor

save project

parent f47689a4
Showing with 14 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
lujuren=Hero("绿巨人",100,20)
libai=Hero("李白",80,30)
meiguoduizhang=Hero("美国队长",105,25)
print("绿巨人的血量:",lujuren.hp)
print("李白的血量:",libai.hp)
print("美国队长的攻击力:",meiguoduizhang.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