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 = [] total = []
while True: while True:
unit=input("请输入:") unit=input("请输入:")
...@@ -13,5 +13,12 @@ def daima(): ...@@ -13,5 +13,12 @@ def daima():
total.append(unit) total.append(unit)
finally: finally:
print('-'*30) print('-'*30)
print(total) return total
daima() def sum(money):
\ No newline at end of file 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