Commit 8006f870 by BellCodeEditor

save project

parent d1ced12b
Showing with 20 additions and 13 deletions
import func
a=func.new_input()
func.total_price(a)
\ No newline at end of file
def new_input():
a=[]
def new_input():#收集分数
total=[]
while True:
b=(input('请输入价格:(退出请按q)'))
if b=='q':
price=(input('请输入分数:(退出请按q)'))
if price=='q':
break
else:
try:
b=int(b)
price=int(price)
except:
print('请输入整数!')
else:
a.append(b)
total.append(price)
print('-'*80)
return a
c=new_input()
print(c)
for i in c:
print(i,end=' ')
print()
print(c[0])
print(total)
return total
def total(list1):#计算分数
a=0
for i in list1:
a+=i
print('一共'+str(a)+'分')
#list2=new_input()
#total(list2)
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