Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Stressful Subject by mdroz
def is_stressful(subj):
first_red_word = "help"
second_red_word = "asap"
third_red_word = "urgent"
if subj.isupper():
return True
elif subj.isupper() == False:
if subj[len(subj)-1] == subj[len(subj)-2] == subj[len(subj)-3] == "!":
return True
else:
subj = subj.lower()
subj = subj.split()
for w in subj:
i=0
count=0
while i < len(first_red_word):
if w.count(first_red_word[i]) > 0:
count+=1
i+=1
if count == 4:
return True
for w in subj:
j=0
count=0
while j < len(second_red_word):
if w.count(second_red_word[j]) > 0:
count+=1
j+=1
if count == 4:
return True
for w in subj:
k = 0
count =0
while k < len(third_red_word):
if w.count(third_red_word[k]) > 0:
count+=1
k+=1
if count == 6:
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("h!e!l!p") == True, "Second"
print('Done! Go Check it!')
Oct. 30, 2017