24 AnswersNew Answer
24 AnswersNew Answer
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
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.
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)!!! 😱
Ha - okay, I should have thought of that, because that problem happens in other tasks as well. Good you found it. :)
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?
Which task was that again?
copy paste input from comments which is the same as in the 1st test case here it prints open there it prints trash
HonFu sorry! 'It's a sign' it was
HonFu you type very fast😅😂 Let me check if it works
I have never used try catch block in python so can you explain me what is happening here
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.
break statement in try block breaks out of the whole for loop, right?
Yes. So basically, when stuff goes wrong, the loop is aborted.
except and that if statement in try block does the same thing oh man!! i am going crazy because of this
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.
There's the string method strip() to cut off any whitespace from the edge of a string.
There is trim() function also to remove white spaces in string
I didnt notice any problem
because code coach runs it with different inputs and if your code in playground works with different inputs so it should work.
Sololearn Inc.4 Embarcadero Center, Suite 1455
Send us a message