Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Stressful solution in Uncategorized category for Stressful Subject by Elena_Korljukova
def is_stressful(subj):
if subj.isupper() or subj[-3:] =='!!!':
return True
subj = list(filter(lambda x: x.isalpha(), subj.lower()))
a = [0] + [i for i in range(1,len(subj)) if subj[i-1] != subj[i]]
subj = ''.join([subj[i] for i in a])
return 'help' in subj or 'asap' in subj or 'urgent' in subj
if __name__ == '__main__':
print(is_stressful("I neeed HELP"))
#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!')
June 5, 2020