Beauty of Python

Beauty of Python

Advertisemen

I've always had a hatred for Python, slow with horrible syntax.

However, I've just found an advantage. One of Project Euler's problems is to find the last ten digits of:



The other day I read about had Python handles integers, it can handle integers using as much memory as your computer has without requiring any external libraries (which C and C++ does, they only have in-built support for 64 bit integers which isn't enough).

So I opened Python's command line interface and typed the following:
mso 9]>
>>> a=0
>>> for i in range(1,1001):
...     a=a+pow(i,i)
...
>>> print(a)

Problem solved, quickly as well!

So I guess Python does have it's benefits.

Advertisemen

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Game Engine Tutorial