Temperatures puzzle discussion

Ok ! got it thx :slight_smile:

Instructions say:
Display 0 (zero) if no temperatures are provided. Otherwise, display the temperature closest to 0.

However, the test case for no temperatures is expecting no output, contrary to the instructions.

That case does expect an output of 0. Could you please copy and paste whatā€™s shown in the console after you run that case?

Constraint is that the temperature set should contain between 0 and 10K temps => No test case is checking that and/or expecting value/error if set is too big (I truncated it)
Also noted that temps should be in a range between -276 and 5526 => No test case to check that and/or expecting value/error if a temp is out of range (I ignored those values)
Could be good to teach new developers to never trust user inputs :wink:

Tested in C.

Where do you see a case where the inputs violate the constraints/rules?

i placed the temps into a list and used an if statement to check if the length of the list is 0 and if this came back as true i set my answer to 0

after submitting your response they run your code through more test cases to make sure you didnā€™t hard code the solution

Hello ! :slight_smile:
Iā€™ve got a bug with this puzzleā€¦
Unit test 2 and 3 :
Testing with one value = max range.
Testing with one value = min range.
Are not displayed in the run test part during coding, but there are displayed after submissionā€¦
So, I canā€™t reach 100% validationā€¦ :cry:
Any answer ? :slight_smile:

I donā€™t quite understand your question, but yes, you do have to write a solution general enough to pass the hidden validators. This applies to all puzzles here, where most of the visible cases are different from the validators.