Skip to content

Instantly share code, notes, and snippets.

@dumpmycode
Last active March 2, 2016 07:43
Show Gist options
  • Save dumpmycode/f7d321a35eba232eac1d to your computer and use it in GitHub Desktop.
Save dumpmycode/f7d321a35eba232eac1d to your computer and use it in GitHub Desktop.
pythonpractice.org - list comprehension(fibonacci numbers)
#! /usr/bin/env python
def fibo(num):
b = [0,1] #seed list with 0,1
[b.append(b[i]+b[i+1]) for i in range(num)]
print b
fibo(int(raw_input('enter a number: ')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment