Demo entry 5865318

Anki pygments test

   

Submitted by anonymous on Aug 15, 2016 at 22:35
Language: Python 3. Code size: 277 Bytes.

def fib(n):
    """Print a Fibonacci series up to n."""
    a, b = 0, 1
    while a < n:
        print(a, end=' ')
        a, b = b, a+b
    print()

# Now call the function we just defined:
fib(2000)

# Returns
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).