Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
phone_no = input("Enter phone number : ")
phone_list = phone_no.split("-")
len_phone_part = [3,3,4]
result = 1
if len(phone_list) == 3 :
for y,x in zip (len_phone_part , phone_list) :
if len(x) != y :
result = 0
break
else :
result = 0
if result == 1 :
phone_list[2] = "XXXX"
phone_list[1] = phone_list[1][:2] + "XX"
print ("-".join(phone_list))
else :
print ("Invalid phone number :")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.