Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Stressful Subject by Phil15
from string import ascii_lowercase
def is_stressful(subject):
"""recoognise stressful subject"""
if subject[-3:]=='!!!' or subject.upper()==subject:
return True
#Keep only letters.
subject = [ch for ch in subject.lower() if ch in ascii_lowercase]
#Remove duplicate letters.
subject = [subject[0]] + [elem for i, elem in enumerate(subject)
if i >= 1 and elem != subject[i-1]]
#I look for red word.
return any(red in ''.join(subject) for red in {"help", "asap", "urgent"})
July 19, 2018
Comments: