class sort(object): def __init__(self,num_arrayt): self.num_array=num_array def accept(self): for i in range(int(x)): n=raw_input("num :") num_array.append(int(n)) def radix(self): b=[] f=[] d1=10 d2=1 n=1 while n<=3: f=[0,0,0,0,0,0,0,0,0,0] j=0 while j<int(x): f[(num_array[j]%d1)/d2]+=1 j=j+1 i=1 while i<10: f[i]=f[i]+f[i-1] i+=1 l=int(x)-1 while l>=0: b[f[(num_array[l]%d1)/d2]]=num_array[l] f[(num_array[l]%d1)/d2]-=1 l-=1 k=0 while k<int(x)-1: num_array[k]=b[k] k+=1 d1=d1*10 d2=d2*10 n+=1 def display(self): print(num_array) num_array=list () x=raw_input("Enter how many 3 digit no.u wanna to insert in the string" ) obj=sort(num_array) obj.accept() obj.radix() obj.display()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question