Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bubbleSort(myList2):
- for i in range(len(myList2)):
- for j in range((len(myList2)-1)):
- if myList2[j] > myList2[j+1]:
- myList2[j],myList2[j+1] = myList2[j+1],myList2[j]
- return myList2
- # main function
- print("Enter the array to be sorted : ")
- myList1 = list(map(int, input().strip().split(",")))
- bubbleSort(myList1)
- print("The List after applying Bubble Sort is : ")
- print(myList1)
Add Comment
Please, Sign In to add comment