Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mask_3rd(word):
- if len(word) < 3:
- return word
- else:
- ch = word[2]
- ret = word.replace(ch, "*")
- return "".join([ret[:2], ch, ret[3:]])
- print(mask_3rd('logging'))
- print(mask_3rd('apple'))
- print(mask_3rd('orange'))
- print(mask_3rd('gooooogle'))
- print(mask_3rd('i'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement