Why does python add an 'L' on the end of the result of large exponents? [duplicate]

不羁岁月 提交于 2019-11-27 07:59:42

Python supports arbitrary precision integers, meaning you're able to represent larger numbers than a normal 32 or 64 bit integer type. The L tells you when a literal is of this type and not a regular integer.

Note, that L only shows up in the interpreter output, it's just signifying the type. If you print that result instead:

>>> print(25 ** 25)
88817841970012523233890533447265625

The L doesn't get printed.

In Python 3, these types have been merged, so Python 3 outputs:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 24 ** 24
1333735776850284124449081472843776
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!