def format_age(s): chars = list(s) # list of characters digit_chars = [c for c in chars if c.isdigit()] return int("".join(digit_chars))