Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Yet another First solution solution in Clear category for Stressful Subject by sjosef23
def is_stressful(subj):
"""
recognise stressful subject
"""
if subj.isupper() or subj[-3:] == '!!!':
return True
red_words = ["help", "asap", "urgent"]
import itertools
subj = ''.join(c for c, _ in itertools.groupby(subj.lower()) if c.isalpha())
return any([w in subj for w in red_words])
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert is_stressful("help") == True, "First"
assert is_stressful("sda a!!!!") == True, "Second"
assert is_stressful("Hi") == False, "Third"
assert is_stressful("I neeed HELP") == True, "Fourth"
print('Done! Go Check it!')
Oct. 24, 2019