函数的冒泡排序: 本质是,让元素换位置,逐个比较最终排序. 例1:实现a1,a2值互换: a1 = 123 a2 = 456 temp = a1 a1 = a2 a2 = temp print(a1) print(a2) 结果: 456 123 冒泡排序: #!/bin/bash/env python # -*- coding:utf-8 -*- li = [22,1,5,4,3,66,22,12,34,21] for j in range(1,len(li)): for i in range(…