Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Stressful Subject by Aleksej_Bulygin
import re
def is_stressful(subj):
if subj.isupper() or "!!!" == subj[-3:] or \
re.search(r'h[^a-gi-z]*?e[^a-df-z]*?l[^a-km-z]*?p', subj.lower()) or \
re.search(r'a[^b-z]*?s[^a-rt-z]*?a[^b-z]*?p', subj.lower()) or \
re.search(r'u[^a-tv-z]*?r[^a-ps-z]*?g[^a-fh-z]*?e[^a-df-z]*?n[^a-mo-z]*?t', subj.lower()):
return True
return False
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!')
Aug. 16, 2022