Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Stressful Subject by pokosasa
def is_stressful(subj):
if subj.isupper() or subj[-3:]=="!!!":
return True
red_words=["help","asap","urgent"]
subj=subj[0]+"".join(c for i,c in enumerate(subj[1:]) if c.isalpha() and c!=subj[i])
return any(red_word in subj.lower() for red_word in red_words)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert is_stressful("Hi") == False, "First"
assert is_stressful("I neeed HELP") == True, "Second"
assert is_stressful("helph") == True, "Third"
print('Done! Go Check it!')
July 10, 2019