+ 1

What test case does this code fail? (Code Coach Security)

G should be between T and $ everytime a string with these characters and x's is entered. There could be many Gs but only one T and one $. V1 works and V2 doesn't. I found one case where it failed (reversed, T doesn't count? dunno. T$xx...G was the one that failed) So I changed lo.index('T') with (lo+x). index('T') and thus got rid of the error. SoloLearn says it still fails in the third case, so I put the other code back, but I am wondering what the problem is. Could you give me some ideas? I need to be better at input analysis. It's like 75% of the whole thing, I feel. But I also feel I am running the risk of mindless practice when I rush through the homework at my low level so I'll try to revisit the harder ones at times to make them better if I can. Did you construct maps, flow charts etc when you were a beginner? Any tips for at least a-not-stupid way of studying? Thanks in advance. https://code.sololearn.com/cwWZvs1SkG8m/?ref=app https://code.sololearn.com/cGM5jeaEVcGB/?ref=app

21st Mar 2022, 5:03 PM
Korkunç el Gato
Korkunç el Gato - avatar
6 Respuestas
+ 1
x = input() x = x.replace('x', '') if '$T' in x or 'T
#x27; in x: print('ALARM') else: print('quiet')
21st Mar 2022, 5:40 PM
Shadoff
Shadoff - avatar
+ 1
Ne demek, cnm. Baş üstüne! Gerçi İngilizce anlarım ve baya iyi de anlatabilirim. Ama sanırım Türkçe sizin ana diliniz, o yüzden Türkçe konuşmak bence daha iyi gelir
21st Mar 2022, 5:56 PM
Shadoff
Shadoff - avatar
+ 1
Güzel, anlamlı, "cazibedar" kod yazabilme yeteneğinde vakitle geliyor. Zaman, tecrübe, hırs, kod yazma sevgisi, yetenekden üstün gelir
21st Mar 2022, 5:59 PM
Shadoff
Shadoff - avatar
22nd Mar 2022, 6:38 AM
CodeStory
CodeStory - avatar
+ 1
CodeStoryRe'yi daha öğrenmedim. Böylelikle öğrenirim. Sağ olun :-)( Men hali Re tilini o'rganmaganman. Men shunday o'rganaman. rahmat /I haven't studied "re" yet. I'll learn learn about it thanks to this. Thank you.)
22nd Mar 2022, 1:28 PM
Korkunç el Gato
Korkunç el Gato - avatar
0
I didn't mean to offend you anyway. If it happened, I am apologizing. what else? Want to learn? Good. You will. Have a nice day. Happy coding
21st Mar 2022, 6:16 PM
Shadoff
Shadoff - avatar