def return_sorted_list(unsorted_list):
sorted_list = unsorted_list[:]
for i in range(0,len(sorted_list)):
for i in range(0,len(sorted_list)):
if i < (len(sorted_list) - 1):
current_item = sorted_list[i]
next_item = sorted_list[i+1]
if current_item > next_item:
sorted_list[i] = next_item
sorted_list[i+1] = current_item
return sorted_list
print(return_sorted_list([3,4,2,6,7]))
Nenhum comentário:
Postar um comentário