Skip to content

Commit 7b2d436

Browse files
Merge pull request raviprakashdev#2 from codec-akash/master
Create Sorting using python
2 parents 8ee109c + 3f2764b commit 7b2d436

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Sorting using python

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def bubblesort(list):
2+
3+
# Swap the elements to arrange in order
4+
for iter_num in range(len(list)-1,0,-1):
5+
for idx in range(iter_num):
6+
if list[idx]>list[idx+1]:
7+
temp = list[idx]
8+
list[idx] = list[idx+1]
9+
list[idx+1] = temp
10+
11+
12+
list = [19,2,31,45,6,11,121,27]
13+
bubblesort(list)
14+
print(list)

0 commit comments

Comments
 (0)