Regular expressions · 8 / 15 Exercise Easy

Hide digits

Objective

Create a Python program that hides all the digits of a text with re.sub.

Instructions

  • Read a line of text.
  • Replace each digit with an asterisk * with re.sub(r"\d", "*", text).
  • Show the resulting text.
Input
Mi PIN es 1234
Output
Mi PIN es ****

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise