Temperatures puzzle discussion

Guys i need help, im coding in JS:

`for(var k = 0; k < n; k++) {

// Look for negative closest to 0;
if( tempArr[k] < 0  && tempArr[k] > closestNegValue) {
    if( tempArr[k] > closestNegValue ) {
        closestNegValue = tempArr[k];
    }
}

// Look for the smallest positive
if( tempArr[k] > 0 && tempArr[k] < closestPosValue ) {
    if( tempArr[k] < closestPosValue ) {
        closestPosValue = tempArr[k];
    }
}

}`

My problem is that the smaller positive number is not stored in the variable. the temperature array has numbers like:
tempArr: 42,-5,12,21,5,24

and the closestPosValue gives me back 12 while its clear to see the are smaller number than 12;

Nevermind, I found out that even after you split the tempreatures string into an array, that array still contains strings so you have to use JavaScript Number() Function in order to make it work.

“Training” doesn’t have any “training” to be found I can’t look at any hints or solutions (all locked?), and I don’t even know how to turn one long single text string “1 -2 -8 4 5” into distinct integers that I can compare with each other? Why is this called “Training” if there’s just a problem with no help?

3 Likes

I agree with you, there are no hints. I also don’t Know how to extract string parts.

Which language are you running?

I started trying to do it in Javascript, but when I couldn’t figure it out I looked at Python. They are all the same way. All of the solutions are all locked, and there are no hints. How is this “Training”? Where is the training part? The “Power of Thor” puzzle has hints, including pseudocode, that makes sense, but a puzzle like this with no help? Doesn’t look like training to me.

In Python, strings do have a split method.

Yes, that’s correct, in Python strings have a split method. And that doesn’t address the fact that these “Training” challenges should be called “Test” challenges because there is no Training to be found. No hints, no solutions, no help anywhere, beyond a forum comment saying that Python has split methods. Why is there a list of three dozen solutions and they’re all locked?

Bonjour,

L’ennoncĂ© de ce texte n’est pas clair. contrairement Ă  ce qu’indiquent les commentaires dans le code, les tempĂ©ratures sont gĂ©nĂ©rĂ©s en charcartĂšre ascii est non en entier.
Du coup la manipulation en C en devient plus compliquée.

Also the rules “Display 0 (zero) if no temperatures are provided.” is not valid if printf(“0\n”); is used. Only printf(""); pass the test


Hello, coding this in Python 3. All the test cases work great, but I get the following results on the second test case:

Temps: -12 -5 -137

Console output
Standard Output Stream:
5
Failure
Found: 5
Expected: -

I assume that the program should not be expecting a - sign as the answer to this. Anyone else run into this?

Why not? Temperatures can be negatives.

Slt tt le monde
Je veins d’obtenir 91% parce que je n’aurai pas utiliser le -273 alors que ben evidemment je m’en suis servi de la meme maniĂšre que l’autre extremitĂ©.
Du genre if x > temp max ou min.
pas tres grave of course mais j’aurai aimĂ© comprendre why

Un problùme de borne ? > au lieu de >= ? Quoiqu’il en soit, quand on te donne “-273” dans temps, ton programme doit sortir -273. :slight_smile:

Effectivement c’etait ca. J’ai changĂ© en >= et du coup c’est passĂ©.
Merci.
Par contre pourquoi c’est passĂ© pour 5526 sans le =, ça c’est un aute pb.

Au pif, je dirais que tu initialises ta variable a tempsMax.

Alguien hizo el de temperatures en javascript? Si pruebo mi cĂłdigo en consola o en un debugger me sale todo bien, pero aqui no

@JavierMonda you might want to switch to english so more people can help you. Also don’t hesitate to explain what is blocking you. In this thread, you’ve got plenty of resources to help you finish the puzzle.

Hello, I would like to ask everyone a question about this puzzle. I solved it and passed all of the tests, however, when I submitted it, I didn’t get the 100% achievement. Can someone explain why please?

Hi There

I pass all of test but unfortunately I get only 81%
 So i’m sad a little bit. I tried to figure out what would be the problem.

  • -273 alone. Wait
 what
 ok
 I tried a lot of things Draw some bro to him/or her, make a party but he/she is uneven

  • -10 and -10 are equal 
 öööö yep they are. They know we pass trough 1789 and egalitĂ© fraternitĂ© and so on
 I’ll tried let they read Orwell so maybe one of them want to be more equal, but nothing happened.
    So if anyone could help me in c# what wrong with them, I would be happy again.