Skip to content

Instantly share code, notes, and snippets.

@jeacom25b
Created February 7, 2017 23:49
Show Gist options
  • Save jeacom25b/ea120fc6dd6d2d765aba586c5b33660d to your computer and use it in GitHub Desktop.
Save jeacom25b/ea120fc6dd6d2d765aba586c5b33660d to your computer and use it in GitHub Desktop.
#infinite for loop
b = [1,2]
for i in range(len("loops")):
for a in b:
b.append(a)
print (a)
c = [1,2] * 5
#never reaches#
print (b, c)
@Rigner
Copy link

Rigner commented Feb 7, 2017

You add new a in b
So each time there's one more value to process in the for loop
So yeah rip your infinite loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment