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:
str=file.readlines()
a=[]
for data in str:
new_data=data.split()
sum=0
for i in new_data[1:]:
sum+=int(i)
result=new_data[0]+str(sum)
a.append(result)
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
class Hero:
def __init__(seif):
seif.level=1
seif.hp=300
seif.attack=20
yase=Hero()
print(yase.level)
print(yase.hp)
print(yase.attack)
\ 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