Skip to content

Instantly share code, notes, and snippets.

@devils-ey3
Created September 21, 2016 11:12
Show Gist options
  • Save devils-ey3/8a3518c4988a873c8b685e6d8c57c540 to your computer and use it in GitHub Desktop.
Save devils-ey3/8a3518c4988a873c8b685e6d8c57c540 to your computer and use it in GitHub Desktop.
Insert Sort code by python
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