Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input = 1212
- output = 2121
- for i in range(len(listofnumbers)):
- if listofnumbers[i] == 1:
- listofnumbers[i] = 2
- else:
- listofnumbers[i] = 1
- Python 2.7.15 (default, May 27 2018, 08:15:19)
- [GCC 5.5.0 20171010] on linux2
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import string
- >>> "12121212".translate(string.maketrans("12", "21"))
- '21212121'
Add Comment
Please, Sign In to add comment