Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # scramble_sort.py.py
- sss = ['stop', 'star', 'arts', 'tops', 'start', 'pots', 'tars', 'rats', 'foo']
- def fnA(s): return ''.join(sorted(list(s)))
- def fnB(s): return sorted([x for x in sss if fnA(x) == s])
- r = sorted([fnB(x) for x in set(fnA(s) for s in sss)])
- print r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement