Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Stressful Subject solution in Uncategorized category for Stressful Subject by vvm70
from itertools import groupby
def is_stressful(s):
a = ''.join(filter(str.isalpha, s.lower()))
flag = [word for word in ("asap", "help", "urgent") if word in ''.join(k for k, g in groupby(a))]
return any((s.isupper(), s.endswith("!!!"), *flag))
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 H!Eee!L!pppP!") == True, "Second"
print('Done! Go Check it!')
June 21, 2020