6 ms·
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,
by jakubw 15y 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.
- jimrhoskins 15y agoAlso, the JS seems to be quirky: function jsChallenge() { return 1; return 2; return 3; } Returns 3
- kingkilr 15y agodef 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.
- ecounysis 15y ago> The Python version seems to be using an interpreter that frankly just doesn't work: NameError: name 'reduce' is not defined
- sblom 15y agoIf 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.