Infinite for in python3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Infinite for in python3

is there a way to make an infinite for loop?

29th Mar 2018, 12:17 AM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
3 Answers
+ 8
Try this: for i in iter(int, -1): pass
29th Mar 2018, 2:07 PM
ƒred
ƒred - avatar
+ 1
Why? It’s better to use a while loop such as while true:
29th Mar 2018, 1:03 AM
Ariela
Ariela - avatar
- 1
I don’t think it’s possible in python
29th Mar 2018, 1:03 AM
Ariela
Ariela - avatar