Advertisement
here2share

# scramble_sort.py

Nov 3rd, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # scramble_sort.py.py
  2.  
  3. sss = ['stop', 'star', 'arts', 'tops', 'start', 'pots', 'tars', 'rats', 'foo']
  4. def fnA(s): return ''.join(sorted(list(s)))
  5. def fnB(s): return sorted([x for x in sss if fnA(x) == s])
  6. r = sorted([fnB(x) for x in set(fnA(s) for s in sss)])
  7. print r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement