Skip to content

Commit 86da255

Browse files
DiptoChakrabartyMadhavBahl
authored andcommitted
Bubblesort.py (#219)
* Bubblesort.py Bubble sort using loops * Update Bubblesort.py
1 parent 8590718 commit 86da255

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

day31/python/Bubblesort.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```
2+
Name:Dipto Chakrabarty
3+
Topic:Bubble Sort
4+
Date:1/02/2019
5+
```
6+
7+
#taking the array and storing in a list
8+
l=list(map(int,input().split()))
9+
n=len(l) #length of list
10+
for i in range(n):
11+
for j in range(n-i-1):
12+
#sorting based on conditions
13+
if(l[j]>l[j+1]):
14+
l[j],l[j+1]=l[j+1],l[j]
15+
print(l)

0 commit comments

Comments
 (0)