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")5 Respuestas
+ 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
+ 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: "Tquot; or "$T" ☺️
+ 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")
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?
0
In the settings, in the section "Terms of Services", the email address is specified:
info@sololearn.com