Commit f8d88f30 by BellCodeEditor

auto save

parent 024fb164
total = [] def func():
while True: total = []
unit= input("请输入:") while True:
if unit== 'q': try: #尝试运行
unit= int(input("请输入:"))
except: #如果输入的不是整数,则执行except下面的语句
print("请输入整数")
else: #如果输入的数据符合要求,则执行else下面的语句
if unit==0:
break break
else: else:
total.append(unit) total.append(unit)
print(total) print(total)
\ No newline at end of file return total
def jisuan(total):
count = 0
for i in total:
count = count + i
return count
# abc = func()
# jiage = jisuan(abc)
# print(jiage)
\ No newline at end of file
import func
data = func.func()
zf = func.jisuan(data)
print("总分是:", zf)
\ 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