Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Stressful Subject by vlader
def is_stressful(subj):
"""
recoognise stressful subject
"""
if "!!!" in subj[-3:]:
return True
if subj.isupper():
return True
new = ""
n = ""
for i in subj.lower():
if i.islower():
if i != n:
new += i
n = i
if "help" in new:
return True
elif "asap" in new:
return True
elif "urgent" in new:
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"
print('Done! Go Check it!')
July 17, 2018