Guest User

Untitled

a guest
Nov 9th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. import itertools
  2. def function(x):
  3. G = list(itertools.permutations(list(str(x))))
  4. G = list(set([int(''.join(i)) for i in G]))
  5. G.sort()
  6. i = G.index(x)
  7. if i + 1 < len(G):
  8. return(G[i+1])
  9. else:
  10. return(-1)
Add Comment
Please, Sign In to add comment