Solution Review: Decode the Message
The solution to the 'Decode the Message' challenge.
We'll cover the following
def decode(func):def wrapper(message):# Sorting the message after being cleanedmessage = sorted(func(message))for index in range(0, len(message)):n = 0-(int(message[index])-9) # Mapping numbers to their actual valuesmessage[index] = str(n)s = ""return s.join(message)return wrapper@decodedef clean_message(message):# Removing every character that's not digitcleaned = [character for character in message if character.isdigit()]return cleanedprint(clean_message('323 23jdfd9 1323'))
Get hands-on with 1400+ tech skills courses.