这就是我所做的,但没有奏效:
def min_sorted(xs):
copy_list= xs
list=[]
while copy_list:
minimum=copy_list[0]
for i in copy_list:
if i < minimum:
minimum = i
if not i == minimum:
list.append(minimum)
print (list)
这就是我所做的,但它没有像这样工作,有人可以帮我检查一下吗?
ex: xs = [7, 8, 3, 1, 5]
min_sorted([7, 8, 3, 1, 5]) ====> [1, 3, 5, 7, 8]
xs ====>[7, 8, 3, 1, 5]