Answer:
Complete Python code with step by step comments for explanation are given below.
Python Code:
# creating a function named scrabble_number that will take num as input argument
def scrabble_number(num):
# print the original number
print("The original number is: ",num)
# we can implement the required logic by using python built-in functions join() and zip()
scrambled = ''.join([char[1]+char[0] for char in zip(num[::2], num[1::2])])
# print the scrambled number
print("The scrambled number is: " + str(scrambled))
Driver code:
scrabble_number('123456')
Output:
The original number is: 123456
The scrambled number is: 214365