Commit 006e394a by BellCodeEditor

save project

parent 3249ef80
# file1=open(r"C:\Users\Administrator\Desktop\test.txt","w",encoding='utf-8')
# file1.write('小兰:12本')
# file1.close()
# file1=open(r"C:\Users\Administrator\Desktop\test.txt","w",encoding='utf-8')
# file1.write('老马:12本\n')
# file1.write('小强:10本\n')
# file1.close()
# file1=open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding='utf-8')
# file1.write('小兰:12本')
# file1.close()
with open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding='utf-8') as
file:
file.write('小兰:12本')
\ No newline at end of file
def daima():
def new_input():
total = []
while True:
unit=input("请输入:")
......@@ -13,5 +13,12 @@ def daima():
total.append(unit)
finally:
print('-'*30)
print(total)
daima()
\ No newline at end of file
return total
def sum(money):
count=0
for i in money:
count=count+i
return count
# price=new_input()
# pay=sum(price)
# print('您消费'+str(pay)+'元,扫码还是现金')
\ No newline at end of file
import func
data=func.new_input()
score=func.sum(data)
print('总分为'+str(score)+'分')
\ 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