DEV Community

Discussion on: Daily Challenge #32 - Hide Phone Numbers

Collapse
 
matrossuch profile image
Mat-R-Such

Python

def hide(n):
    n = n.replace('-', '')
    if len(n) < 10 or len(n) > 10 or n.isdigit() == False :  return False
    n=n[:4]+('X'*6)
    return '%s-%s-%s' %(n[:3],n[3:6],n[6:])