SHARE
TWEET

Untitled

a guest Jul 17th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def mask_3rd(s):
  2.  
  3.     if len(s) > 4:
  4.         r = s.replace(s[2], "*")
  5.         r = r[:2] + s[2] + r[3:]
  6.         return r
  7.     else:
  8.         return s
  9.  
  10.  
  11. print(mask_3rd("logging"))
  12. print(mask_3rd("apple"))
  13. print(mask_3rd("orange"))
  14. print(mask_3rd("gooooogle"))
  15. 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
 
Top