Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Many steps solution in Clear category for Stressful Subject by bryon.hance
def is_stressful(subj):
"""
recoognise stressful subject
"""
if subj.isupper() or subj.endswith('!!!'):
return True
subj_list = [c.lower() for c in subj if c.isalpha()]
subj = ''
last_char = ''
for char in subj_list:
if char != last_char:
subj += char
last_char = char
for red_word in ('help','asap','urgent'):
if subj.find(red_word) > -1:
return True
return False
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("h!e!l!p"), "Third"
print('Done! Go Check it!')
Sept. 3, 2019