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: class hero:
a=file1.readlines() def __init__(self):
list_name=[] self.level=1
sum=0 self.hp=300
for i in a: self.attack=20
data=i.split() yase=hero()
for j in data[1:]: print(yase.hp)
sum=sum+int(j) \ No newline at end of file
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
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