Last active
August 29, 2015 14:04
-
-
Save andfoy/724eef1fb004848dc1c6 to your computer and use it in GitHub Desktop.
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
import numpy as np | |
l = np.random.randint(0, 1000, 10).tolist() | |
b = {} | |
a = [] | |
max = 0 | |
for i in l: | |
if len(str(i)) > max: | |
max = len(str(i)) | |
for i in range(0, max)[::-1]: | |
for n in l: | |
try: | |
b[int(str(n)[i]) = b[int(str(n)[i]) + [n] | |
except KeyError: | |
b[int(str(n)[i]) = [n] | |
except IndexError: | |
a.append(n) | |
l = [] | |
[l.extend(j) for j in b.values()] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment