Hidden test cases | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hidden test cases

When doing a practice code, some test cases are hidden, why? I just submitted a code and all test cases were positive, but one hidden one. I couldn't see why was it wrong, since it's locked. I was namely doing Lists V test, but it was happening before with other tests in Python Core course. What gives? How could i unlock those locked test cases?

21st Jan 2024, 8:08 AM
Igor Matić
Igor Matić - avatar
21 Answers
+ 4
when input n = -100, n is <= 7
21st Jan 2024, 9:57 AM
Lisa
Lisa - avatar
+ 5
Igor Matić , we can make the code a bit more clear like: > if the input number is in the range() of *0* upto the *length of the list*: output the item from the list by using the input as an index [...] else: output the required *error message* (check the spelling of the message)
21st Jan 2024, 10:54 AM
Lothar
Lothar - avatar
+ 5
Hidden test cases are very common on most coding platforms and MOOC's. Your code should always perform correctly according to the challenge, otherwise a student could game the system by hard coding the output.
21st Jan 2024, 3:34 PM
Keith
Keith - avatar
+ 5
IMO, Sololearn is the most user friendly platform for an introduction to coding. You get byte sized lessons and a bunch of experts that hang around to help newbies. If someone is jaded because of hidden test cases they will be even more so if/when they take a Computer Science course from one of the big MOOC'S or begin climbing the ladders at hackerrank where 8 of 10 cases are commonly hidden. As Lisa pointed out, if the test cases don't pass the logic is incorrect.
22nd Jan 2024, 9:38 AM
Keith
Keith - avatar
+ 3
It clearly says in the yask description "if n < 0 or n >7". That is NOT "knowledge not taught". If a task cannot be solved with the course knowledge, the task is INADEQUATE, not the test case. Hidden test cases are necessary so people focus on the logic instead of focusing on the output.
21st Jan 2024, 1:28 PM
Lisa
Lisa - avatar
+ 2
no. it means the logic of your code doesn't meet the task instruction
21st Jan 2024, 9:12 AM
Lisa
Lisa - avatar
+ 2
Igor Matić , I'm also one of the ones who believes the test cases should not be hidden, especially since to pass some of them requires knowledge not taught. (What a nasty trick, that!) I always passed them, but only because I'm a non-newbie who can rely on previous knowledge. Make a suggestion by sending Feedback via the main menu or emailing info@sololearn.com as I did.
21st Jan 2024, 1:19 PM
Rain
Rain - avatar
+ 2
Rain Thanks for telling me how sl works, but sl broke tagging and it only works at random. Reported it multiple times.
21st Jan 2024, 1:37 PM
Lisa
Lisa - avatar
+ 1
you find the ossue by comparing your code to the task instruction and think about which input would break your code. if you need help with your code, give a complete task description and show your code.
21st Jan 2024, 9:34 AM
Lisa
Lisa - avatar
+ 1
hidden test cases exist because if you could see the input you could just do an if statement to match all the inputs provided and output the expected output, which would be kinda cheating
21st Jan 2024, 7:02 PM
Nest Admiral
Nest Admiral - avatar
0
So, hidden cases may require a more advanced approach than what the lesson is teaching at the moment, in order to be correct?
21st Jan 2024, 9:10 AM
Igor Matić
Igor Matić - avatar
0
But how do i see where is the error? It's just one test case out of 5 that is wrong.
21st Jan 2024, 9:31 AM
Igor Matić
Igor Matić - avatar
0
I did so, included the required conditions as it stands in the task. https://ibb.co/sPtBJGZ the task. https://ibb.co/LgBhnKW test cases.
21st Jan 2024, 9:52 AM
Igor Matić
Igor Matić - avatar
0
Ah, i see, so my code would take negative input and work with it in both statements. Thank you. I was thinking this whole time about a way to do the comparison if user input was a string, but that wasn't in the task, and brain stopped working. :)
21st Jan 2024, 10:05 AM
Igor Matić
Igor Matić - avatar
0
Lisa , To address a comment to someone, type @, and choose their name from the list.
21st Jan 2024, 1:31 PM
Rain
Rain - avatar
0
Lothar there was no mention of ranges in the course so far.
21st Jan 2024, 3:22 PM
Igor Matić
Igor Matić - avatar
0
Lisa i understand that. But on the other hand, i believe test cases are meant to serve as feedback, no? And "the code is broken here, fix it" is imho more valid feedback than "the code is broken, fix it".
21st Jan 2024, 3:25 PM
Igor Matić
Igor Matić - avatar
0
Keith , You can only game the system to pass one test case at a time, so even with all test cases visible, you would still have to write performant code to pass all of them. The cheaters don't need to game the system or write good code, because they can just copy code from the comments and breeze through to a certificate without understanding anything. The hidden test cases don't hurt the cheaters. They hurt the people who want to debug their own code and learn how things work. And you haven't addressed that Sololearn sometimes test things before teaching them.
21st Jan 2024, 5:06 PM
Rain
Rain - avatar
0
Keith , You still haven't addressed Sololearn's nasty habit of testing what it hasn't taught.
22nd Jan 2024, 11:18 AM
Rain
Rain - avatar