Guest User

Untitled

a guest
Jun 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. input = 1212
  2.  
  3. output = 2121
  4.  
  5. for i in range(len(listofnumbers)):
  6. if listofnumbers[i] == 1:
  7. listofnumbers[i] = 2
  8. else:
  9. listofnumbers[i] = 1
  10.  
  11. Python 2.7.15 (default, May 27 2018, 08:15:19)
  12. [GCC 5.5.0 20171010] on linux2
  13. Type "help", "copyright", "credits" or "license" for more information.
  14. >>> import string
  15. >>> "12121212".translate(string.maketrans("12", "21"))
  16. '21212121'
Add Comment
Please, Sign In to add comment