I need to return the given puzzle with each alphabetic character replaced by the HIDDEN character.
HIDDEN = '^'
def blah(r):
r = HIDDEN * len(r)
return r
This function works for replacing any string I need, but the question specifically asks that each ALPHABETIC character be replaced.
So I can’t have 4 or ' or ? being replaced with HIDDEN because they’re not alphabetic characters.
How should I go about this?
One approach: use the translate method:
Another approach: use
re.sub: