Skip to content

Commit cdcc8b9

Browse files
committed
Added solution to bubble-sort in python.
1 parent 8316198 commit cdcc8b9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

solutions/python/bubble-sort.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
def bubblesort(lst):
3+
for i in range(0,len(lst)-1):
4+
for j in range(i+1,len(lst)):
5+
if lst[i]>lst[j]:
6+
temp=lst[i]
7+
lst[i]=lst[j]
8+
lst[j]=temp
9+
return lst
10+
11+
l=[1,4,2,4,6,2,6,8,5,8,9,5]
12+
for i in bubblesort(l):
13+
print (i)

0 commit comments

Comments
 (0)