Commit 1f02df4d by BellCodeEditor

save project

parent 6aed5c7b
Showing with 11 additions and 2 deletions
path = r'C:\Users\MAKCOO-03\Documents\lesson13-1\sales_list.txt'
with open(path, 'r', encoding='utf-8') as file:
for i in file.readlines():
print(i.split(' '))
\ No newline at end of file
line = i.split(' ')
#print(line)
sum = 0
for J in range(0, len(line)-2):
sum += int(line[J + 1])
if len(line[-1]) > 1:
sum += int(line[-1][:len(line[-1])])
print(f'{line[0]}:{sum}元')
print(len())
\ 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