SHARE
TWEET

Untitled

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