Skip to content

Instantly share code, notes, and snippets.

@JulianMiller
Created March 6, 2012 05:15
Show Gist options
  • Save JulianMiller/1983743 to your computer and use it in GitHub Desktop.
Save JulianMiller/1983743 to your computer and use it in GitHub Desktop.
# Blastoff!
def countdown(n):
while n >= 1:
print n
n = n -1
else:
if n == 0:
print 'Blastoff!'
countdown(10)
#DaveAnswer
def countdown(n):
while n > -1:
if n==0:
print 'Blastoff!'
else:
print n
n=n-1
countdown(3)
def countdown(n):
while n >= 0:
if n > 0:
print n
else:
print "Blastoff!"
n=n-1
countdown(3)
#refactoring
def countdown(n):
while n >= 1:
print n
n = n -1
if n == 0:
print 'Blastoff!'
countdown(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment