+ 1

On hackerrank the compiler used for doing practice for python had error , show wrong answer if the code is perfectly fine why??

Coding

24th Feb 2019, 2:16 PM
Whack Hack
Whack Hack - avatar
8 odpowiedzi
+ 1
Perhaps the code itself is wrong. Or the IDE is using another version of Python (e.g. Python 2, PyPy2, PyPy3).
24th Feb 2019, 2:40 PM
Diego
Diego - avatar
0
Wouldn't it make more sense to tell hacker rank about an error at hacker rank?
24th Feb 2019, 2:43 PM
HonFu
HonFu - avatar
0
It would help if you provided additional information. Hackerrank has memory and time limits so although your code is correct it may not be optimal. For example there is a practice test that requires to find the count of the maximum integer values in a list. The first principals Python 3 code would be: count = 0 for i in list: if i == max(list): count += 1 return count However an optimal solution is: return list.count(max(list)) Which uses a built in method Hope that helps
24th Feb 2019, 2:43 PM
Mike Buttery
Mike Buttery - avatar
0
Maybe your code output dont satisfy one of tests case though it satisfy others
24th Feb 2019, 3:23 PM
KrOW
KrOW - avatar
0
KrOW no everything is fine because my output match the solution
24th Feb 2019, 3:25 PM
Whack Hack
Whack Hack - avatar
0
Its not important than the output match the sample solution.... Exists many test cases just for this and your code has to output right data to all test cases
24th Feb 2019, 3:26 PM
KrOW
KrOW - avatar
0
KrOW thanks
24th Feb 2019, 3:27 PM
Whack Hack
Whack Hack - avatar
0
Whack Hack 👍👍👍
24th Feb 2019, 3:28 PM
KrOW
KrOW - avatar