Commit 79355da4 by BellCodeEditor

save project

parent edb766e0
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
def new_input():
total = []
while True:
unit = input('请输入(q退出):')
if unit == 'q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
finally:
print("=====================")
return total
def sum(money):
count = 0
for i in money:
count = count + i
return count
import func
data=func.new_input()
print(data)
score=func.sum(data)
print(score)
max=0
max_index=0
min=999999
min_index=0
for i in range(len(data)):
if data[i]>max:
max=data[i]
max_index=i
if data[i]<min:
min=data[i]
min_index=i
if max_index>min_index:
data.pop(max_index)
data.pop(min_index)
else:
data.pop(min_index)
data.pop(max_index)
print(data)
avg=func.sum(data)/len(data)
print(avg)
\ 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