Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def swapNeighbouringDigits(n):
- string = str(n)
- string_length = len(string)
- new_string = ""
- x = 0
- while (x < string_length):
- new_string = new_string + string[x + 1] + string[x]
- x = x + 2
- return int(new_string)
Advertisement
Add Comment
Please, Sign In to add comment