+ 1
Code coach problems [SOLVED]
Is anyone else experiencing some problems in the code coach section? The code works fine on sololearn playground but doesn't work on the code coach section
24 Answers
+ 3
ok i got it
actually it is appending '\r' at the end of each string (except the last one) so that was the reason it doesnt form a palindrome
after replacing '\r' with '' it works fine
+ 4
If only 1-2 tests fails and you have tested your code in another editor, try to cut the end of the input strings.
Eg. in Python try:
s = input().strip()
or sometimes
s = input()[:-1]
It worked for me.
+ 2
Aaah, I remember!
I also had some issues there. My suspicion was that it has to do with Sololearn's input situation, or at least is something similar.
Like the EOF Error we sometimes get, you know?
To evade this, I used this method:
for i in range(3):
try:
inp = input()
if not inp:
break
except:
break
I don't know why it worked, only that it worked.
And now that I look at it again:
I wrote 3!
Why did this code even pass?!
So I guess you must be right - there are issues!
EDIT: It even works with range(1)!!! 😱
+ 2
Ha - okay, I should have thought of that, because that problem happens in other tasks as well.
Good you found it. :)
+ 1
There are other reports about that in this forum, but usually it turns out that there's a slight detail you may have missed.
Do you want to share your attempt, have us take a look?
+ 1
Which task was that again?
+ 1
copy paste input from comments which is the same as in the 1st test case
here it prints open
there it prints trash
+ 1
HonFu sorry! 'It's a sign' it was
+ 1
HonFu you type very fast😅😂
Let me check if it works
+ 1
I have never used try catch block in python so can you explain me what is happening here
+ 1
It's the same like in other languages:
I put the input into the try block, so if there's *any* error, the except part (==catch) is executed.
And that part only breaks out of the for loop.
I don't even know why I had to write it.
+ 1
break statement in try block breaks out of the whole for loop, right?
+ 1
Yes. So basically, when stuff goes wrong, the loop is aborted.
+ 1
except and that if statement in try block does the same thing
oh man!!
i am going crazy because of this
+ 1
There is a problem with me that I have experience about indendation in python, but you can solve easily doing with delete and space keyboard. You delete spaces until you are on the left, and press space into right, and making sure that statements are in same line when they have to be in the same line.
+ 1
There's the string method strip() to cut off any whitespace from the edge of a string.
+ 1
There is trim() function also to remove white spaces in string
+ 1
I didnt notice any problem
0
because code coach runs it with different inputs and if your code in playground works with different inputs so it should work.