Commit f270ba44 by BellCodeEditor

save project

parent f2c12d81
Showing with 21 additions and 4 deletions
score={"语文":91,"数学":88,"英语":85} class Hero():
for k,v in score.items(): def __init__ (self,attack):
print(k,v) self.level=1
\ No newline at end of file self.name=name
self.hp=250
self.attack=40
def combat(self,enemy):
enemy.hp -= self.attack
info1 = self.name+"攻击了"+enemy.name
info2 = "造成了"+self.attack+"点伤害"
if enemy.hp > 0:
info3 = enemy.name+"剩余"+enemy.hp+"点血量"
info = info1+info2+info3
print(info)
else:
info3 = enemy.name+"已阵亡,游戏结束"
info = info1+info2+info3
print(info)
exit()
\ 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