Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Your implementation looks fine. This calculation is so trivial for a computer to do that it's not worth spending much time optimizing the implementation.

That said, the fact that you called print without parentheses indicates that you are using Python 2. In Python 2, xrange() would be slightly preferable to range() xrange() would be slightly preferable to range().

Alternatively, keep using range(), and call print() with parentheses to make your program compatible with Python 3.

Your implementation looks fine. This calculation is so trivial for a computer to do that it's not worth spending much time optimizing the implementation.

That said, the fact that you called print without parentheses indicates that you are using Python 2. In Python 2, xrange() would be slightly preferable to range().

Alternatively, keep using range(), and call print() with parentheses to make your program compatible with Python 3.

Your implementation looks fine. This calculation is so trivial for a computer to do that it's not worth spending much time optimizing the implementation.

That said, the fact that you called print without parentheses indicates that you are using Python 2. In Python 2, xrange() would be slightly preferable to range().

Alternatively, keep using range(), and call print() with parentheses to make your program compatible with Python 3.

Source Link
200_success
  • 145.5k
  • 22
  • 190
  • 479

Your implementation looks fine. This calculation is so trivial for a computer to do that it's not worth spending much time optimizing the implementation.

That said, the fact that you called print without parentheses indicates that you are using Python 2. In Python 2, xrange() would be slightly preferable to range().

Alternatively, keep using range(), and call print() with parentheses to make your program compatible with Python 3.

lang-py

AltStyle によって変換されたページ (->オリジナル) /