+ 2

Can python ranges reach infinity? Or what's the highest range?

Just a question...

16th Jun 2020, 11:20 AM
Aaron Luke Olvida🇵🇭
Aaron Luke Olvida🇵🇭 - avatar
2 ответов
+ 2
Maybe not. I tried: from math import inf range(inf) But it didn't work.
16th Jun 2020, 11:35 AM
Seb TheS
Seb TheS - avatar
+ 2
Range takes int as arguments, inf is float. You can either use a while loop, incrementing your value as long as you need it, or write a generator function for that.
16th Jun 2020, 12:12 PM
HonFu
HonFu - avatar