Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Stressful Subject by jusha
import re
def is_stressful(subj):
if subj.endswith('!!!') or subj.isupper():
return True
s = ''
for i in subj.lower():
if i.isalpha():
s += i
a = re.search(r'h+e+l+p+',s)
b = re.search(r'a+s+a+p+',s)
c = re.search(r'u+r+g+e+n+t+',s)
if a or b or c:
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!')
April 16, 2020
Comments: