Commit 2881c32f by BellCodeEditor

save project

parent 2de051d3
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
import sb
a=sb.new_input()
print(a)
b=sb.s(a)
print(b)
\ No newline at end of file
def new_input():
total = []
zong=0
list=[]
while True:
unit= input("请输入(退出按q):")
if unit== 'q':
b=input("请输入值(退出按q)")
if b == "q":
break
try:
b=int(b)
except:
print("输入错误!")
else:
try:
unit=int(unit)
except:
print("请输入正确的价格")
else:
zong=zong+unit
print("总共花费")
return zong
a=new_input()
print(a)
\ No newline at end of file
list.append(b)
return list
def s(o):
zong=0
for i in o:
zong=zong+i
return zong
\ No newline at end of file
file=open(r"C:\Users\Administrator\Desktop\text.txt","w",encoding="utf-8")
file.write('小兰:12本')
file.close()
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