Last active
March 2, 2016 07:43
-
-
Save dumpmycode/f7d321a35eba232eac1d to your computer and use it in GitHub Desktop.
pythonpractice.org - list comprehension(fibonacci numbers)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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