Commit 90e07dec by BellCodeEditor

save project

parent 9a581ef4
Showing with 13 additions and 13 deletions
# 英雄角色类 with open()as file:
class Hero(object): a=file.readline()
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击 final_sum=[]
??? for i in a:
data=i.split()
sum=0
for sales in data[1:]
sum=sum+int(sales)
result = data[0]+str(sum)+'\n'
final_sum.append(result)
yase = Hero("垭瑟") with open()as file:
houyi= Hero("后羿") file.writelines(final_sum)
yase.combat(houyi) \ No newline at end of file
\ 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