参考代码:
def fun_1(ls): # 输入10个数
ls = list(map(int, input().split()))
return ls
def fun_2(ls): # 进行处理
my_min = min(ls)
my_index = ls.index(my_min)
temp = ls[0]
ls[0] = ls[my_index]
ls[my_index] = temp
my_max = max(ls)
my_new_index = ls.index(my_max)
new_temp = ls[-1]
ls[-1] = ls[my_new_index]
ls[my_new_index] = new_temp
return ls
def fun_3(ls): # 输出10个数
for i in range(10):
print(ls[i], end=" ")
ls = []
rel = fun_1(ls)
new_rel = fun_2(rel)
fun_3(new_rel)
0.0分
0 人评分
C语言训练-排序问题<1> (C++代码)浏览:600 |
C语言训练-素数问题 (C语言代码)浏览:998 |
C语言程序设计教程(第三版)课后习题9.3 (Java代码)浏览:966 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:572 |
A+B for Input-Output Practice (III) (C语言代码)浏览:576 |
【排队买票】 (C语言代码)浏览:900 |
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:907 |
C语言考试练习题_一元二次方程 (C语言代码)浏览:576 |
数对 (C语言代码)浏览:702 |
愚蠢的摄影师 (C++代码)浏览:938 |