fork download
  1. import re
  2.  
  3. chosen_word = "to crank (sth) up"
  4. # To make the space between words double for better legibility
  5. hidden_word = re.sub("\s", " ", chosen_word)
  6.  
  7. # To hide the letters of the word
  8. hidden_word = re.sub(r"(\bto\b|\(s(?:th|b)\))|[a-z]", lambda x: x.group(1) or "_ ", hidden_word)
  9. print( hidden_word )
Success #stdin #stdout 0.03s 9492KB
stdin
Standard input is empty
stdout
to  _ _ _ _ _   (sth)  _ _