Objective
Create a Python program that changes the format of all the dates in a text using re.sub with groups.
Instructions
- Read a line of text that may contain dates with the format
YYYY-MM-DD. - With
re.sub, convert each date to the formatDD/MM/YYYY, reusing the groups in the replacement:re.sub(r"(\d{4})-(\d{2})-(\d{2})", r"\3/\2/\1", text). - Show the resulting text. Anything that is not a date is left unchanged.
Hoy es 2026-11-13
Hoy es 13/11/2026
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise