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(): def new_input():#收集分数
a=[] total=[]
while True: while True:
b=(input('请输入价格:(退出请按q)')) price=(input('请输入分数:(退出请按q)'))
if b=='q': if price=='q':
break break
else: else:
try: try:
b=int(b) price=int(price)
except: except:
print('请输入整数!') print('请输入整数!')
else: else:
a.append(b) total.append(price)
print('-'*80) print('-'*80)
return a print(total)
c=new_input() return total
print(c) def total(list1):#计算分数
for i in c: a=0
print(i,end=' ') for i in list1:
print() a+=i
print(c[0]) 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