0

Question about my solution for code coach Security

Here’s my code for the Security code coach. As it is, it works for 4 out of 6 of the tests. But if I change alarm so that it only equals “T$G” and not the other three letter combinations , it works fine and I complete the code coach. Does anyone know why it does this? input = input() string = "" x = "x" alarm = "T$G" "G$T" "GT

quot; "$TG" for i in input: if i not in x: string += i if alarm in string: print("ALARM") else: print("quiet")

26th Jul 2021, 9:13 PM
Alex
Alex - avatar
5 RĂ©ponses
+ 2
first of all you are using reserved keywords for identifiers which is very bad ! start the core python course from the beginning and also read the comments in comment section of every lesson ! make sure your code goes with all this conditions --> T$G TG$ $TG $GT GT$ G$T also their are more than one Guards G$G is quite GG$GGGG is quite
26th Jul 2021, 10:24 PM
Ratnapal Shende
Ratnapal Shende - avatar
+ 2
The code, with my amendment, does not have to perform all the tests, I just showed you that, according to the logic of your code, you should search for a "string" in the "alarm", and not vice versa, but there are many more options for schemes than you indicated. But in the beginning, everything is much easier, you need to look for only two options in the line: "T
quot; or "$T" â˜ș
26th Jul 2021, 11:58 PM
Solo
Solo - avatar
+ 1
Congratulations! 👏👏👏👏👏 You have found a buggy tester. 👍 You can report this to the SoloLearn administration. But there is a significant error in your code. Debug: if string in alarm: print("ALARM") else: print("quiet")
26th Jul 2021, 10:50 PM
Solo
Solo - avatar
0
Thanks Vasiliy, I didn’t realize that was messing up the code. With my way most of the test cases still worked so I figured the error was something else. But even with your correction test case four doesn’t work. So how do I report that to admin?
26th Jul 2021, 10:59 PM
Alex
Alex - avatar
0
In the settings, in the section "Terms of Services", the email address is specified: info@sololearn.com
26th Jul 2021, 11:42 PM
Solo
Solo - avatar