|
pyboardCN V2畅玩 python简单算法的移植
[复制链接]
- [code]list = [3, 1, 5, 7, 8, 6, 2, 0, 4, 9]
- def choice(list):
- for i in range(0,len(list)):
- min_loc = i
- for j in range(i+1,len(list)):
- if list[min_loc]>list[j]: #最小值遍历比较
- min_loc = j
- list[i],list[min_loc] = list[min_loc],list[i]
- return list
- choice(list)
复制代码
可以通过choice直接在终端打印出结果,也可以采用串口等通信方式传输到pc显示。串口输出时忘记转换ASCII了![]()
|
|