Created
September 21, 2016 11:12
-
-
Save devils-ey3/8a3518c4988a873c8b685e6d8c57c540 to your computer and use it in GitHub Desktop.
Insert Sort code by python
This file contains 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
a = [] | |
i = (int) (input("How much element do you want : ")) | |
for element in range(i): | |
a.append((int)(input("> "))) | |
for element in range(1,i): | |
j = element | |
while j > 0 and a[j] < a[j-1]: | |
a[j-1],a[j]=a[j],a[j-1] | |
j-=1 | |
for element in range(i): | |
print(a[element],end=' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment