Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to create infinite loops using a for loop in Python. However, it is not recommended to do so as it can cause the program to hang or crash. An example of an infinite loop using a for loop is as follows:

for i in range(0,1):
    print(i)

This loop will print out the value 0 and then continue indefinitely, as the range function will always return a list of one item, and the loop will never exit.