Last active
June 5, 2022 15:36
-
-
Save PushkraJ99/49b65b7e9adffa93ed377200fec84c21 to your computer and use it in GitHub Desktop.
Bubble Sort Using Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Bubble Sort using Python (Github:-PushkraJ99) | |
def sort (num): | |
for i in range (len(num)-1,0,-1): | |
for j in range (i): | |
if num [j]>num[j+1]: | |
temp =num[j] | |
num[j]=num[j+1] | |
num[j+1]=temp | |
num=[1,5,8,9,4,7,6] | |
print(num) | |
sort(num) | |
print(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment