Sorting the numbers in the List

L=int(raw_input("Enter the length of list: "))
p=list()
for i in range(L):
      num=int(raw_input("Enter the elements : "))
      p.append(num)
print '\nUnsorted list is: ',p
for i in range (len(p)):
 for j in range (i+1,len(p)):
  if p[i]>p[j]:
   t=p[i]
   p[i]=p[j]
   p[j]=t
else:
 print '\nSorted List is:' ,p

No comments: