Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import itertools
  2. pin = raw_input()
  3. def get_pins(x):
  4. D = {
  5. 1:['1','2','4'],
  6. 2:['1','2','3','5'],
  7. 3:['2','3','6'],
  8. 4:['1','4','5','7'],
  9. 5:['2','4','5','6','8'],
  10. 6:['3','5','6','9'],
  11. 7:['4','7','8'],
  12. 8:['5','7','8','9','0'],
  13. 9:['6','8','9'],
  14. 0:['8','0']
  15. }
  16. L = []
  17. total = []
  18. for i in x:
  19. L.append(D[int(i)])
  20. for y in L:
  21. for i in itertools.permutations(y,len(x)):
  22. total.append(''.join(i))
  23. print L
  24. return sorted(total)
  25.  
  26. print get_pins(pin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement