# Temperatures puzzle discussion

Thanks a lot!

Bonjour. Je suis totalement dĂ©butant en code, et je nâarrive pas Ă  rĂ©soudre ce problĂšme. Je pensais utliser la recherche dichotomique pour le rĂ©soudre aprĂšs avoir triĂ© la liste mais je suis perdu entre tous les programmes que je trouve sur le net. Je travaille sur Python. Pouvez vous mâaider ? Merci

Câest le puzzle oĂč il faut trouver la tempĂ©rature la plus proche de 0 ?
Poste ton script en privĂ©, on pourra tâaider.

so iâm using Rust: i get the smallest temp with using an if and comparing the read values against each other. For that i transform all temperature to a positive using the .abs() method. The problem i have now is that i am stuck and dont know how to display the coresponding negative number to my positive values

How about using an additional variable to store the corresponding negative number?

1 Like

No need to use an array to solve this puzzle. It can be solved just comparing every input to the last result in the for-loop.

i need help it asks for a one then a negative five

and im using java

And itâll ask for different correct numbers (answers) for different tests and validators. Thatâs because your code must be general enough to solve all tests and validators.

The statement asks the output to be:

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

With the following input, the closest to 0 is 1:

5
1 -2 -8 4 5

But if I change slightly the input, then the closest to 0 because -2:

4
-2 -8 4 5

So you need to find which one is closest to 0, whether itâs from the negative or positive side.

hello, I am having trouble with getting 100% on this coding game.
it states that I have done 100% on my test cases. However, when I go to submit it says that I didnât complete test cases 3 but I have.
Can you give me some help with this.

Many Thanks

Tests and validators are different. Your code may not be general enough to pass all the validator cases.

hello there,
I am learning Python
Canât get 100% with my code because of this validator that I donât understand
âTwo negative temperatures that are equal: {-10 -10}â
here is my solution
[Mod edit: Please avoid posting codes on the forum]
Can anyone give me a hint

The code youâve posted is incomplete. Anyway, please try to avoid posting codes on the forum.

What does your code output if the temperatures given are -10 and -10?

Itâs my first time doing a challange on this page. I dont understand how the console.log works. when i do i console.log() in the code, it wonât show on the console page on the left bottomâŠdo i have to click somewhere to run my code?

Have you clicked any PLAY button below your code?

Also, if you want to display anything other than the answer, you have to use console.error instead.

Si une seule valeur est envoyĂ©e, tu dois la retourner telle quelle.

4 Likes