Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: