Commit e5dd2e99 by BellCodeEditor

save project

parent 7fb61303
Showing with 12 additions and 12 deletions
with open(r'C:\Users\Administrator\Desktop\demo.txt','r',encoding'utf=8') as sb: class Hero:
a=sb.readlines() def __init__(self)
for i in a: self.level = 1
date=i.split() self.hp= 300
sum=0 self.attack= 20
for sales in date[1:]
sum=sum+int(sales)
result=date[0]+str(sum)
print(result) yase=Hero()
with open(r'C:\Users\Administrator\Desktop\demo.txt','a',encoding'utf=8') as sb: print("yase的血量为:",yase.hp)
file.writelines() print("yase的攻击为:",yase.attack)
\ 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