def sor(a,t): print a for i in range(1,t): for j in range(0,t-i): if a[j]>a[j+1]: temp=a[j] a[j]=a[j+1] a[j+1]=temp print a mylist=[43,5,4,23,4,45,5,655] s=len(mylist) sor(mylist,s) new=int(raw_input("enter the number")) mylist.append(new) p=len(mylist) sor(mylist,p)
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletedef sor(a,t):
ReplyDeleteprint a
for i in range(1,t):
for j in range(0,t-i):
if a[j]>a[j+1]:
temp=a[j]
a[j]=a[j+1]
a[j+1]=temp
print a
mylist=[43,5,4,23,4,45,5,655]
s=len(mylist)
sor(mylist,s)
new=int(raw_input("enter the number"))
mylist.append(new)
p=len(mylist)
sor(mylist,p)
[43, 5, 4, 23, 4, 45, 5, 655]
[4, 4, 5, 5, 23, 43, 45, 655]
enter the number32
[4, 4, 5, 5, 23, 43, 45, 655, 32]
[4, 4, 5, 5, 23, 32, 43, 45, 655]
>>>