Temperatures puzzle discussion

wait, what?

image

1 Like

Yeap sorry didn’t read that.

I have exactly the same problem with this.
Maybe it’s a bug so we can’t pass this test :slight_smile:

Edit: I’ve just figured it out after I replied to you XD

This is the moment where I realize how handy C# is when you are coming from C++.
There is no need to worry about the case if there are no values delivered because a int is 0 per default. Not so in C++…

Bonjour, je débute sur codingame, et je ne comprends pas le message d’erreur :
voici mon code, si une bonne âme passe da

Bonjour, je débute sur codingame, et je ne comprends pas le message d’erreur :
SyntaxError: invalid syntax
at Answer.py. not in a function on line 17
(c’est la ligne du else if)
voici mon code, si une bonne âme passe dans les parages…

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

result = 0

n = int(input())  # the number of temperatures to analyse
for i in input().split():
    # t: a temperature expressed as an integer ranging from -273 to 5526
    t = int(i)
    if math.fabs(t) < math.fabs(result) :
        result = t    
    else if ( math.fabs(t) == math.fabs(result) ) :
        if t > result : # found same value, but positive
        
print ("resultat : ", result)

# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr)

print("result")

It’s elif in Python, not else if.

It’s elif in Python, not else if.

Thanks !
I’am Pyhthon beginner, I’ve been found out :wink:
Best regards,
SG

It appears that the C++ test cases are broken. Here are my results for the first 2 (“found” is my answer, “expected” is the test case’s answer):

Simple test case
Standard Output Stream:
1
-2
-8
4
5
0

Failure
Found: 0
Expected: 1

My Explanation: 0 is closer to 0 than 1

Only negative numbers
Standard Output Stream:
-12
-5
-137
-1

Failure
Found: -1
Expected: -5

My Explanation: -1 is closer to 0 than -5

You can have a look at the test cases using the button at the top left corner of the testcases panel:

image

image

je confirme la remarque de NewBo merci pour l’info.

i check mi code en C#, and it works perfectly, but in two test (3,4), not work, and when i send my answer even test 1 fails. plz check it

There is most likely one (or more) bug(s) in your code. Please check it.

1 Like

My solution passes all the tests but when I submit, the score computer seems to freeze.

We had an issue yesterday with the submits. It’s solved.

1 Like

What are the testcases 7 and 8? they are not shown in the list of cases to execute. it ends at 6.

they are shown in the results panel, aren’t they?
image

results panel yes, and there I was surprised to learn I failed test 7. The test cases panel only goes to 6.

yes, there are two additional validators compared to the tests. Their names should be self-explanatory in any case you fail them.