Security problem in Python. | Sololearn: Learn to code for FREE!


Security problem in Python.

Hey guys, I was trying to solve this question but seems like the compiler reads my code in wrong way. I think I've done right. Out of 5 tests it qualifies in 4 only fails the first test which I think it shouldn't as I checked it. Here is the question: Pls let me know what in my code is wrong. Thank you. And here is the code that I wrote: floor=input() count=0 for i in range(len(floor)): if floor[i]=='x': continue elif floor[i]=='$' or floor[i]=='T': if count==1: print('ALARM') break else: count+=1 elif floor[i]=='G': if count==1: print('quiet') break else: print('ALARM') break else: break

5/27/2021 12:58:27 PM


1 Answer

New Answer


For this input xxxxxGxx$xGxT your code deliver ALARM and this is wrong. Try to solve this.