Skip to content

Instantly share code, notes, and snippets.

@tdsmith
Created March 21, 2012 20:37
Show Gist options
  • Save tdsmith/2152650 to your computer and use it in GitHub Desktop.
Save tdsmith/2152650 to your computer and use it in GitHub Desktop.
darkside:Desktop tim$ python uh2.py
outer
inner
inner
inner
outer
inner
inner
inner
outer
inner
inner
inner
***
outer
inner
inner
inner
outer
inner
inner
inner
outer
inner
inner
inner
*****
outer
inner
inner
inner
outer
inner
inner
inner
outer
inner
inner
inner
#!/usr/bin/python
i = 0
while True:
j = 0
print 'outer'
while True:
print '\tinner'
j += 1
if j == 3: break
i += 1
if i == 3: break
print '\n***\n'
i = 0
while True:
j = 0
print 'outer'
while True:
try:
print '\tinner'
j += 1
if j == 3: raise Exception('lolz')
except Exception, e:
break
i += 1
if i == 3: break
print '\n*****\n'
i = 0
while True:
j = 0
print 'outer'
try:
while True:
print '\tinner'
j += 1
if j == 3: raise Exception('lulzier')
except Exception, e:
pass
i += 1
if i == 3: break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment