Commit 6b1b3f4d by BellCodeEditor

auto save

parent 5ec53ebb
Showing with 32 additions and 0 deletions
class Hero:
def __init__(self,level,hp,attack):
self.level=level
self.hp=hp
self.attack=attack
def shengji(self):
self.level = self.level+1
self.hp = self.hp+2000000000000000000000000000000000000000000000000
self.attack = self.attack+999999999999999999999999999999999999999
chx=Hero(1,500,101)
q = Hero(1,200,91)
chx.shengji()
q.shengji()
print(chx.level,chx.hp,chx.attack)
print(q.level,q.hp,q.attack)
\ No newline at end of file
with open(r'C:\Users\EDZ\Desktop\dd.txt','r',encoding='utf-8') as wenjian:
a=wenjian.readlines()
for i in a:
j=i.split()
k=j[1:]
sum = 0
for i in k:
sum = sum+int(i)
jieguo = j[0] + str(sum)
print(jieguo)
with open(r'C:\Users\EDZ\Desktop\dd1.txt','a',encoding='utf-8') as wenjian:
wenjian.writelines(jieguo+'\n')
\ 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