Commit dd181fda by BellCodeEditor

auto save

parent e2a5bc03
import j #func指代上一程序的文件名,根据实际修改
# 调用自定义的输入函数,实现分数输入的功能
data1 = j.data()
# 调用自定义的求和函数,计算需要支付的总价
score = j.total(data1)
print("这位选手的总分数为:"+str(score)+"分")
total = [] def total(z):
while True: q=0
unit= input("请输入:") for i in z:
if unit== 'q': q=q+i
break print(q)
else: return(q)
total.append(unit) d=total(we=[1,2,3,4])
print(total) print(d)
\ No newline at end of file \ No newline at end of file
def data():
z=[]
while True:
a=input("输入价格")
if a=="s":
break
else:
try:
a1=int(a)
except:
print("格式错误,请输入数字")
else:
z.append(a1)
#print(z)
return(z)
b=data()
print(b)
def total(b): #z代表任意列表名
t=0
for i in b:
t=t+i
print(t)
return(t)
total(b)#调用函数,
q=[] for j in range(1,10):
while True: for i in range(1,j+1):
try: print(i,"*",j,"=",i*j,sep="",end=" ")
age=int(input("几岁了")) print()
except:
print("要输入整数")
else:
if age<18:
print("不可以喝酒哦")
print("结束")
menu=input("你要点什么菜?")
if menu=="stop":
break
else:
q.append(menu)
print(q)
import j
f=j.data()
g=j.total(f)
print("总分是"+str(g)+"分")
\ 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