Guest User

Untitled

a guest
Jul 17th, 2019
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def mask_3rd(n):
  2. if len(n) < 3 :
  3. return n
  4. mask_char = n[2]
  5. r_word = ""
  6. for i in range(len(n)):
  7. if n[i] == mask_char and i != 2 :
  8. r_word += "*"
  9. else:
  10. r_word += n[i]
  11. return r_word
  12.  
  13. print(mask_3rd("logging"))
  14. print(mask_3rd("apple"))
  15. print(mask_3rd("orange"))
  16. print(mask_3rd("gooooogle"))
  17. print(mask_3rd("i"))
  18. print(mask_3rd("ii"))
  19. print(mask_3rd("iii"))
RAW Paste Data