Skip to content

Instantly share code, notes, and snippets.

@jkern
Created December 2, 2009 06:22
Show Gist options
  • Save jkern/246994 to your computer and use it in GitHub Desktop.
Save jkern/246994 to your computer and use it in GitHub Desktop.
# This is a good start. -- jkern
def fib():
"""A generator for Fibonacci numbers,that goes to the next number and adds it to the current"""
x = 0
y = 1
counter = 0
#while 1: # The trouble starts here. -- jkern
while counter < 100:
# return x # you don't need this -- jkern
x, y = y, x + y # nice! (where did you find this?) -- jkern
# n = fib() # lol wut? This is cool, it's almost recursion ... -- jkern
# for x in range(100): # Here be dragons! -- jkern
print x
# I've left an error in here, somewhere ... remember Ctrl-C breaks.
# You were really, really close.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment