+ 1
Security code coach task
In the security task can the input involve 2 $ signs or only one and if yes how do I output alarm and quiet ?
5 Respostas
+ 8
Med Hedi Bejaoui , please show us your attempt. thanks!
+ 5
"There is one money location, one thief, and any number of guards on each floor of the casino."
You can have multiple guards.
In Python you can remove all of the floor 'x' from the input string. Then all that will be left are the $, T, and G's. Then all you need to do is a check if T is next to $ ('T#x27; or '$T') in the string and output the correlating string. 'ALARM' or 'quiet'.
+ 3
Check out 👇
s=input()
a=0
for i in range(len(s)-1):
if s[i] =='#x27;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]=='#x27;:
a=2
break
if a==1:
print ("quiet")
break
elif a==2:
print("ALARM")
break
+ 1
It is one $ sign.There are one place for 💰 one for T(thief) one for (G)guard the other place are X characters.
0
Did you ever solve this? I found a interesting solution if you're interested?