Hacker News new | ask | show | jobs
by jakubw 5235 days ago
The Python version seems to be using an interpreter that frankly just doesn't work:

    x = [1, 5, 3, 2, 6, 4]
    x.sort()
    print x

    Output: [1, 3, 2, 4, 5, 6]
Not to mention the incomplete standard library. I'm not sure what is the interpreter they're using but it's actually not that hard to sandbox the CPython one and disable certain functions/modules if necessary.
3 comments

    def pyChallenge():
      print sum(s for s in range(1000) if s % 7 != 0 and s % 5 != 0)

    pyChallenge()
Produces a TypeError, and using xrange produces a NameError (Python 3?). I have no idea what they're trying, but it doesn't work.
I assume it's Python 2 (print is a keyword, not a function).
Ah of course, a SyntaxError would take precedence over their broken builtins.
Also, the JS seems to be quirky:

    function jsChallenge() { 
      return 1;
      return 2;
      return 3;
    }
Returns 3
> The Python version seems to be using an interpreter that frankly just doesn't work:

  NameError: name 'reduce' is not defined
If it's python3, the previously built-in reduce() has been relegated to the functools module. But I don't think this is python 3.

I'm not sure what it is, but I know I don't like "guess which subset of the language you get" being harder than actually solving the algorithms challenges.