0010-编程打卡:按照如下规则对数组进行处理
本帖最后由 不二如是 于 2022-8-29 17:49 编辑一星答案:
def arrOrder(the_list):
num = max(the_list)-min(the_list)
dic = {}
for i in range(1,len(the_list)+1):
dic = the_list
new_list = []
for a in dic:
if dic == min(the_list):
dic += num
elif dic == max(the_list):
dic -= num
new_list.append(dic)
print(new_list)
if __name__ == '__main__':
the_list =
arrOrder(the_list)#
二星答案:
import random
counts = 100
while counts:
temp =
total = sum(temp)
print(temp)
temp, temp = temp, temp
temp, temp[-1] = temp[-1], temp
print(temp)
if total != sum(temp):
print('There is something wrong!')
break
counts -= 1
三星答案:
**** Hidden Message *****
基础语法:
https://www.bilibili.com/video/BV1c4411e77t
算法讲解:
https://www.bilibili.com/video/BV1HT4y1K7DY
你举的例子好像是最大与最小互换??? 看来我语文没学好。。最大值难道不是应该放在 list 的位置么。。最小值应该在 list[-1] 呀。。为啥子最大和最小做了互换。。是题目描述有误吧。。{:9_229:} 举的例子好像和题目不一样? 就算我用numpy模块
也不能导入
模块都没有
>>> import numpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
>>>
页:
[1]