From a039b3e97d48496430cc8e944f087a60566a09de Mon Sep 17 00:00:00 2001 From: vrushalikale17 <103527274+vrushalikale17@users.noreply.github.com> Date: Tue, 4 Oct 2022 17:48:41 +0530 Subject: [PATCH] Bubble sort using python.py Please have a look at my code for bubble sort using python programming language. --- Bubble sort using python | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Bubble sort using python diff --git a/Bubble sort using python b/Bubble sort using python new file mode 100644 index 0000000..7571c0f --- /dev/null +++ b/Bubble sort using python @@ -0,0 +1,18 @@ +def bubbleSort(array): + + for i in range(len(array)): + + for j in range(0, len(array) - i - 1): + + if array[j] > array[j + 1]: + + temp = array[j] + array[j] = array[j+1] + array[j+1] = temp + +data = [-2, 45, 0, 11, -9] + +bubbleSort(data) + +print('Sorted Array in Ascending Order:') +print(data)