Here's a code for selection sort but it doesn't print the sorted list. How can I show it?
badlist = input("Enter list: ")
def select(badlist):
l = list[:]
sorted = []
while len(l):
lowest == l[0]
for x in l:
if x < lowest:
lowest = x
sorted.append(lowest)
l.remove(lowest)
return sorted
select(badlist)
print select(badlist)l = list[:]; don't name your variables the same as builtins.sorted = []and thensorted.append(lowest)is just asking for trouble.sorted(list)and then you can just have your whole code be:print sorted(input("Enter list: "))