Challenge: Decode the Message

Decode the message with decorators.

Problem statement

In this problem, you’re required to decode a message. You have to implement a function clean_message decorated by decode. By decoding, we mean:

  • Filter out all the characters that are not the digits.
  • Sort the digits in the ascending order.
  • Map the digits to their actual values.

Mapping is a simple procedure. If you read digit 0, it means that its actual value is 9. Similarly, if you read digit 1, its actual value would be 8. The following figure explains the mapping procedure.

Get hands-on with 1200+ tech skills courses.