Commit 185dd12f by BellCodeEditor

auto save

parent e826d4ab
Showing with 44 additions and 8 deletions
def new_input(): def new_input():
total = [] total = []
while True: while True:
unit= input("请输入:") try:
if unit== 'q': unit= int(input("请输入:"))
except:
print("shuzi")
else:
if unit== 'q':
break
total.append(unit)
new_input()
#创建自定义函数new_input 空列表total 重复让用户输入unit,
# 如果是q就结束程序,否则都加入进去列表里面
def new_input():
total=[]
while True:
unit=input("输入您的内容:")
if unit=="q":
break break
else: else:
total.append(unit) total.append(unit)
a=0
for i in total:
a=a+i
print(total) print(total)
return a new_input()
aaa=new_input()
print(aaa)
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