Security code coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Security code coach

I think i am missing smth but i don't know what it is. Case 6 doesn't work https://code.sololearn.com/cS38peY6gVp6/?ref=app

30th Jul 2020, 6:26 PM
A. Essabbere
A. Essabbere - avatar
6 Answers
+ 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
23rd Jul 2021, 3:15 PM
Tharul Nejana
Tharul Nejana - avatar
+ 1
Therefore you would still have to allow multiple guards next to each other, what your code doesn't. It just allows * x as neighbors.
31st Jul 2020, 12:31 AM
Sandra Meyer
Sandra Meyer - avatar
0
Test case 6 is a bunch of guards between the money and the thief...
30th Jul 2020, 11:35 PM
Sandra Meyer
Sandra Meyer - avatar
0
Btw. it would be much easier, if you were checking for the other cases (thief next to money only).
30th Jul 2020, 11:38 PM
Sandra Meyer
Sandra Meyer - avatar
0
I solved the problem . I just wanted to try out regex
30th Jul 2020, 11:44 PM
A. Essabbere
A. Essabbere - avatar
0
Ruby solution word = gets.chomp.to_s word_new = word.gsub("x","") if((word_new.include? "T
quot;) ||( word_new.include? "$T")) puts 'ALARM' else puts 'quiet' end
13th Apr 2022, 8:32 PM
Seif Eddine N
Seif Eddine N - avatar