Commit f76affdb by BellCodeEditor

save project

parent ad3e6292
Showing with 10 additions and 13 deletions
with open(r'c:\Users\HW\Documents\lesson13_2\sales_list.txt','r','encoding=uft-8') as file: class Hero:
str=file.readlines() def __init__(seif):
a=[] seif.level=1
for data in str: seif.hp=300
new_data=data.split() seif.attack=20
sum=0 yase=Hero()
for i in new_data[1:]: print(yase.level)
sum+=int(i) print(yase.hp)
result=new_data[0]+str(sum) print(yase.attack)
a.append(result) \ No newline at end of file
with open(r'c:\Users\HW\Documents\lesson13_2\sales_list.txt','a','encoding=uft-8') as file:
file.writelines(a)
\ 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