#coding=utf-8
a= []
while 1:
try:
user_input = raw_input('please input a number:')
if user_input.strip() =='over':
break
else:
a.append(int(user_input))
except:
print 'error,try again!'
print a
max_num = max(a)
min_num = min(a)
max_num_index = a.index(max_num) #查找某个元素
min_num_index = a.index(min_num)
#方法1
a[0],a[max_num_index]=a[max_num_index],a[0]
a[-1],a[min_num_index]=a[min_num_index],a[-1]
print a
'''
#方法2
temp =a[0]
a[0]= a[max_num_index]
a[max_num_index]=temp
temp =a[-1]
a[-1]= a[min_num_index]
a[min_num_index]=temp
print a