Skip to content

Commit

Permalink
Bubblesort.py (#219)
Browse files Browse the repository at this point in the history
* Bubblesort.py

Bubble sort using loops

* Update Bubblesort.py
  • Loading branch information
DiptoChakrabarty authored and MadhavBahl committed Feb 7, 2019
1 parent 8590718 commit 86da255
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions day31/python/Bubblesort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```
Name:Dipto Chakrabarty
Topic:Bubble Sort
Date:1/02/2019
```

#taking the array and storing in a list
l=list(map(int,input().split()))
n=len(l) #length of list
for i in range(n):
for j in range(n-i-1):
#sorting based on conditions
if(l[j]>l[j+1]):
l[j],l[j+1]=l[j+1],l[j]
print(l)

0 comments on commit 86da255

Please sign in to comment.