fork download
  1. import re
  2.  
  3. is_lock_ness_monster = lambda string : True if re.search(r'\b(?:tree fiddy|3\.50|three fifty)\b', string) else False
  4.  
  5.  
  6.  
  7. print ("Fixed Tests")
  8.  
  9. def fixed_tests():
  10.  
  11. print ('Basic Test Cases')
  12.  
  13. def basic_test_cases():
  14. print (is_lock_ness_monster ("Your girlscout cookies are ready to ship. Your total comes to tree fiddy"), "---", True)
  15. print (is_lock_ness_monster ("Howdy Pardner. Name's Pete Lexington. I reckon you're the kinda stiff who carries about tree fiddy?"), "---", True)
  16. print (is_lock_ness_monster ("I'm from Scottland. I moved here to be with my family sir. Please, $3.50 would go a long way to help me find them"), "---", True)
  17. print (is_lock_ness_monster ("Yo, I heard you were on the lookout for Nessie. Let me know if you need assistance."), "---", False)
  18. print (is_lock_ness_monster ("I will absolutely, positively, never give that darn Lock Ness Monster any of my three dollars and fifty cents"), "---", False)
  19. print (is_lock_ness_monster ("Did I ever tell you about my run with that paleolithic beast? He tried all sorts of ways to get at my three dolla and fitty cent? I told him 'this is MY 4 dolla!'. He just wouldn't listen."), "---", False)
  20. print (is_lock_ness_monster ("Hello, I come from the year 3150 to bring you good news!"), "---", False)
  21. print (is_lock_ness_monster ("By 'tree fiddy' I mean 'three fifty'"), "---", True)
  22. print (is_lock_ness_monster ("I will be at the office by 3:50 or maybe a bit earlier, but definitely not before 3, to discuss with 50 clients"), "---", False)
  23. print (is_lock_ness_monster (""), "---", False)
  24.  
  25. basic_test_cases ()
  26.  
  27. fixed_tests ()
Success #stdin #stdout 0.03s 9544KB
stdin
Standard input is empty
stdout
Fixed Tests
Basic Test Cases
True --- True
True --- True
True --- True
False --- False
False --- False
False --- False
False --- False
True --- True
False --- False
False --- False