写一个函数,用冒泡法对输入的10个字符按由小到大顺序排列。
def BubbleSort(arr): num = 0 # arr = [10,9,8,7,6,5,4,3,2,1] for i in range(len(arr)): for j in range(len(arr)-i-1): if arr[j] > arr[j+1]: temp = arr[j+1] arr[j+1] = arr[j]