Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Stressful Subject by Julita_Pogorzelska
import string
def is_stressful(subj):
if isallupper(subj):
return True
if wykrzykniki(subj):
return True
if redwords(subj):
return True
return False
def isallupper(subj):
return subj.isupper()
def wykrzykniki(subj):
return subj.endswith('!!!')
def redwords(subj):
subj=subj.lower()
subj=subj.replace('!', '')
subj=subj.replace('-', '')
subj=subj.replace('.','')
lista=list(subj)
maxindex=len(lista)-1
for i in range(maxindex):
if lista[i]==lista[i+1]:
lista[i]=""
subj=''.join(lista)
return "help" in subj or "asap" in subj or "urgent" in subj
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")==True, "Third"
print('Done! Go Check it!')
Dec. 22, 2017