-1

I was working with python and I tried to see what is the largest number a variable in python can hold. Interestingly, I found that I kept on increasing that number and there was no end limit. Is there any max number limit in Python? My code is

import sys
a = sys.maxsize
for i in range(200):
   a *=sys.maxsize
print(a)

and the answer was a 10,12 lines integer.

Ahmad Anis
  • 2,322
  • 4
  • 25
  • 54

1 Answers1

0

Integers in Python can be arbitrarly large. There are lots on articles about how that is handled internally, like https://www.codementor.io/@arpitbhayani/how-python-implements-super-long-integers-12icwon5vk.

Michael H.
  • 3,323
  • 2
  • 23
  • 31