Temperatures puzzle discussion

@Djoums :

  • Please don’t post complete functional code publicly.
  • What is the interest to directly correct his code without more explanations, anyway ?

I know, but this is the 800th comment to a 6 years old easy puzzle. What’s the point of enforcing that rule so strictly ?
The interest seems obvious to me :face_with_raised_eyebrow: Compare the corrected version with the original and see what was wrong, surely that doesn’t need more explanation.

Is the age of the puzzle change anything for new players ? A lot of them want help, not solutions. And those who just want copy-pastable code can search elsewhere. I enforce this rule when needed, not so strictly.
My opinion is that a player which have an “almost functional” code, can investigate a little and ask for help on a precise point, and that a player which have a totally nonfunctionial one can post it without problem.
If you think that a specific player can learn from a complete code (This is not always the case), you can use private messages.

dmaraid, looks like you’re printing the absolute value, not the temp.

ArunJP, maybe try something like
input (number of temps)
if (number of temps) == 0
display 0

I think this is broken. The ‘extra validators to check against hard coded values’ are not doing their job :slight_smile:

I simulated the extra test cases, I 'm getting the correct output.

As written by others in this discussion, it is not broken at all; I was thinking that it was broken too but actually the problem resides somewhere else: check what that failed test is for (Validator 7, i presume) and the Output requested

Check this answer if you want the solution: Temperatures puzzle discussion

1 Like

hello everyone, i am newbie. i didn’t understand question at all can someone explain me in simple words please
thankyou

You’re given temperatures.
Display the one wich is the closest to 0.
In case of equality, display the positive one.

Example 1:
4
2 -1 4 -3
you must display -1

Example 2:
5
2 -1 4 1 -3
you must display 1

2 Likes

thankyou so much pardouin

I am stuck on the last ‘No temperature’ condition, using javascript, any hints how to pass that one?

There are litterally no temperatures so the only input is 0.
In this case you must output 0.

Any reason a number and its associated negative number aren’t equidistant from 0? I.e. why would 100 be closer to origin than -100?

They are equidistant but if you ask for one number, the statement has to choose one.

1 Like

Can someone help me out understand what is this preventing me for getting 100%

02 -273 alone
03 5526 alone

1 Like

I have the same isue 5526 alone on third test why ?

Using C#
having issues with the validators for test 03 much like others before me are. Tests all run correctly however I have tried different methods for each place I could believably see an issue leading to those however it still returns

03 5526 alone

I previously had an issue with 02 however that validated after an adjustment to the starting variable value, however the same fix did not work on Validator 03, resulting in the issue persisting.

The name of the validator couldn’t be more explicit.
You’re given only 1 temperature and you’re even told which temperature it is.
So it should’nt be to hard to debug by yourself.

Go to the settings, activate expert mode, and you’ll be able to add custom testcases.
Add the one corresponding to validator 03, see what your output is, and try to understand why it fails.

1 Like

I had actually found a solution just before I came back in here. Though I did go back and turned on expert mode after you had mentioned it so I could go and see what the issue was before my fix. While you may not have given me the solution, you did give me another tool to use in the future when I am having trouble so thank you.

Hi all,
I’m trying to solve this puzzle using python 3. I’m want help from others,
can I use python 3? Need your screen by anydesk from your device for copy your screen and paste the shown correct answer

My real name is amey,
I know science and coding too.
I need help to which I can use python 3 or not to use?