SHARE
TWEET

Untitled

a guest Jul 17th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2.  
  3. def mask_3rd(s):
  4.     try:
  5.         return s[:2].replace(s[2],"*") + s[2] + s[3:].replace(s[2],"*")
  6.     except IndexError:
  7.         return s
  8.    
  9. print(mask_3rd("logging"))
  10. print(mask_3rd("apple"))
  11. print(mask_3rd("orange"))
  12. print(mask_3rd("gooooogle"))
  13. print(mask_3rd("i"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top