Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Stressful Subject by wo.tomasz
import re
def is_stressful(subj):
return bool(re.match('.*H+E+L+P.*|.*H[^A-Z]E[^A-Z]L[^A-Z]P.*|.*A+S+A+P.*|.*A[^A-Z]S[^A-Z]A[^A-Z]P.*|.*U+R+G+E+N+T.*|.*U[^A-Z]R[^A-Z]G[^A-Z]E[^A-Z]N[^A-Z]T.*|.*!!!$',subj.upper())) or subj.isupper()
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!')
Dec. 3, 2020
Comments: