I ran into a problem when trying to convert a 5,000 digit long integer into a string.
I realised that I did not need an integer in that case, but I would still like to know if there is a way to manipulate integers without converting it to a string.
As an example, if I wanted the first 10 digits of a large integer using the slice operator:
x = 78**100000000
z = str(x)[:10]
print(z)
This would give me an error for trying to convert an integer of length exceeding 4,300 to a string.
Any suggestions would be appreciated!
Qmrl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.