Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import itertools
  2. from collections import Counter
  3. #permutations
  4. print(list(map("".join, itertools.permutations('hello'))))
  5. #n most common elements in arr and num occurences
  6. arr = [1, 3, 4, 1, 2, 1, 1, 3, 4, 3, 5, 1, 2, 5, 3, 4, 5]
  7. counter = Counter(arr)
  8. top_three = counter.most_common(3)
  9. #string at [::-1] is reverse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement