Skip to content

Instantly share code, notes, and snippets.

@concertman
Created March 31, 2011 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save concertman/895779 to your computer and use it in GitHub Desktop.
Save concertman/895779 to your computer and use it in GitHub Desktop.
write the Fibonacci sequence up to n
def fib(n): #write the Fibonacci sequence up to n
"""Print a Fibonacci sequence up to n. """
a, b = 0, 1
while a < n:
print a,
a, b = b, a+b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment