Skip to content

Instantly share code, notes, and snippets.

@chengjun
Last active August 29, 2015 14:03
Show Gist options
  • Save chengjun/ef899f83e662881fb90f to your computer and use it in GitHub Desktop.
Save chengjun/ef899f83e662881fb90f to your computer and use it in GitHub Desktop.
for i in range(-10, 10):
try:
a = 5/i
print a
except:
print 'i = 0'
if i == 3:
print "i ==3"
break
# run a mission many times
times = 0
for i in range(-10, 10):
while times < 4:
try:
print 5/i
break # without break, dead loops!
except:
print 'i = 0'
times +=1
if i == 3:
print "i ==3"
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment