0

Why this fails in 2 test cases ?

This is my code for code coach security problem...please help me find the errors dia = str(input()) money = "

quot; thief = "T" grds = [] for i in range(len(dia)): if dia[i] == "G": grds.append(i) if all(grds) not in range(dia.index(thief),dia.index(money)): print("ALARM") else: print("quiet")

16th Apr 2020, 1:52 PM
Varun Vaswani
Varun Vaswani - avatar
3 Answers
+ 2
This can you see if you would test your code in playground for a few examples and analyse the results.
16th Apr 2020, 4:26 PM
JaScript
JaScript - avatar
+ 1
Please understand the best way to lern is try to solve it yourself. You can take a pencil and paper and sketch the states and try again. Have fun with it.
16th Apr 2020, 5:32 PM
JaScript
JaScript - avatar
0
The only issue is that it doesn't take in count the multiple G's...can anybody give a solution to that ?
16th Apr 2020, 4:34 PM
Varun Vaswani
Varun Vaswani - avatar