Good evening. I have managed to bubble sort listOne. ListTwo will also need sorting. Is there a way to add listTwo into the bubble sort that I already have so that it gets sorted as well. Or do I need to write another loop?
listOne = [3, 9, 2, 6, 1]
listTwo = [4, 8, 5, 7, 0]
def bubbleSort (inList):
moreSwaps = True
while (moreSwaps):
moreSwaps = False
for element in range(len(listOne)-1):
if listOne[element]> listOne[element+1]:
moreSwaps = True
temp = listOne[element]
listOne[element]=listOne[element+1]
listOne[element+1]= temp
return (inList)
print ("List One = ", listOne)
print ("List One Sorted = ", bubbleSort (listOne))
print ("List Two = ", listTwo)
print ("List Two Sorted = ", bubbleSort (listTwo))