Commit 8e6639c5 by BellCodeEditor

save project

parent 59414d18
Showing with 3 additions and 16 deletions
class Hero: name=input("勇于创造的创造师你叫什么啊?")
def __init__(self, hp, name, attack): print(name+"你是最棒的创造师耶")
self.hp = hp \ No newline at end of file
self.name = name
self.attack = attack
self.lv = 1
xiaoming = Hero(10, "小明", 2)
xiaohong = Hero(25, "小红", 10)
print(xiaoming.name, "击败了", xiaohong.name, "的等级增加一级")
def upup(name):
name.lv = name.lv+1
name.hp = name.hp+1
name.attack = name.attack+1
print('现在', name.name, "的等级为", name.lv,"血量为", name.hp, "攻击力为", name.attack)
upup(xiaoming)
\ 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