 Code Coach Security | Sololearn: Learn to code for FREE!

+3

# Code Coach Security

import re inp = input() no_gaurd = re.match(r'T\\$|\\$T|\\$x*T|Tx*\\$', inp) print('ALARM') if no_gaurd else print('quiet') Test 4 which should be ALARM doesn't get matched. Any suggestions?

+16

s = input() m, t = s.find("\$"), s.find("T") x = s[t:m] if m > t else s[m:t] print("quiet" if "G" in x else "ALARM")

+10

inp = input() T, M = (inp.find('T'), inp.find('\$')) if 'G' in inp[T:M] or 'G' in inp[M:T]: print('quiet') else: print('ALARM') Took a different approach thanks

+5

layout=input().replace("x","") print("ALARM" if "T\$" in layout or "\$T" in layout else "quiet")

+4

Check out 👇 s=input() a=0 for i in range(len(s)-1): if s[i] =='\$'or s[i]=='T': for j in range(i+1,len(s)): if s[j]=='G': a=1 break elif s[j]=='T' or s[j]=='\$': a=2 break if a==1: print ("quiet") break elif a==2: print("ALARM") break

+3

Use that, it may help u, but in CSharp https://code.sololearn.com/c7VAUC96mU4N/?ref=app

+1

lel = input() G = 0 T = 0 S = 0 alarm = 0 ub = 0 up = 0 ut = 0 for x in lel: ub += 1 if "G" in x: G = 1 up = ub if "T" in x: T = 1 ut = ub if "\$" in x: S = 1 if G == 1 and S == 1 and T == 0: G = 0 up = 0 S = 0 if G == 1 and T == 1 and up < ut: G = 0 up = 0 if G == 1 and T == 1 and up > ut: T = 0 ut = 0 if T == 1 and S == 1 and G == 0: alarm = 1 break if alarm == 1: print("ALARM") else: print("quiet")

+1

def find_caps(x): return [l for l in x if l.isupper() or l == '\$'] #cut upper letter and \$ string = input() # 'TxxxxxGxx\$xxx' check = ''.join(find_caps(string)) # join new string whis upper letter only if check.find('\$T') == -1 and check.find('T\$') == -1: # check this out print('quiet') else: print('ALARM') # PROFIT :)

0

thought this was cheeky def solution(casino): thief = False money = False guard = False for x in casino: if x == "\$": money = True if thief and not guard: return "ALARM" guard = False if x == "T": thief = True if money and not guard: return "ALARM" guard = False if x == "G": guard = True if thief: thief = False return "quiet" if __name__ == "__main__": casino = input() print(solution(casino))

-1