Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple re solution in Clear category for Stressful Subject by r_tchaik
import re
def is_stressful(subj):
red_words = ("help", "asap", "urgent")
return subj.endswith('!!!') or subj.isupper() or any(
re.search('+\W?'.join(word), subj.lower()) for word in red_words)
if __name__ == '__main__':
#These "asserts" are only for self-checking and not necessarily for auto-testing
assert is_stressful("Hi") == False, "First"
assert is_stressful("I neeed HELP") == True, "Second"
print('Done! Go Check it!')
July 14, 2020
Comments: