Commit 7d8e3660 by BellCodeEditor

save project

parent 79e4a803
Showing with 8 additions and 14 deletions
with open(r"C:\Users\XMBC\Desktop\text.txt",'r',encoding="utf-8") as file1:
a=file1.readlines()
list_name=[]
sum=0
for i in a:
data=i.split()
for j in data[1:]:
sum=sum+int(j)
name=data[0]+" "+str(sum)
list_name.append(name)
with open(r"C:\Users\XMBC\Desktop\text.txt",'a',encoding="utf-8") as file1:
file1.writelines(list_name)
\ No newline at end of file
class hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=20
yase=hero()
print(yase.hp)
\ 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