Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

I have just noticed that while executing large exponent codes, python adds an L letter to the very end of the results:

>>> 25 ** 25

88817841970012523233890533447265625L

After researching, I discovered that any amount that is below 10 doesn't add the L letter. For example:

>>> 9 ** 9

387420489

Why does this happen, is there any function to stop it? 

1 Answer

0 votes
by (107k points)

Please to inform that Python only supports arbitrary precision integers, which means you're able to display larger numbers than a normal 32 or 64-bit integer type. The L letter tells you when a literal is of this type and not a regular integer.

It will only get displayed on the console just to let you know the type of the output. If you print the result, you won't see the L letter:

>>> print(25 ** 25)

88817841970012523233890533447265625

In Python 3, these data types have been combined, so Python 3 output will look like:

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

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...