3 ms·
Why is this interesting? Here's Python code which will take longer than your code: i = 0 while i < 9999**9999: i += 1 print range(10) Assu
by dalke 16y ago
Why is this interesting? Here's Python code which will take longer than your code:
i = 0
while i < 9999**9999:
i += 1
print range(10)
Assuming 10 billion loops per second that's about 10^40000 years before it finishes. Want longer? Put some extra digits on the exponent.
- deleted 16y ago[deleted]
- kevinskii 16y agoActually that is really interesting to me. In the languages I'm familiar with, processing something such as 9999^9999 would require additional logic to avoid overflowing a fixed-size storage unit. I haven't worked with Python at all, and after looking at your reply I did a little bit of research and learned that its long integer type will automatically allocate as many bytes as necessary to get the job done. Very cool. I was thinking that someone would probably show me a better way in another language. Thanks for sharing.