Created
June 21, 2018 01:27
-
-
Save iswarup/6807a96f556332ff8edc168b0f4c9030 to your computer and use it in GitHub Desktop.
Fibonacci Function with user sizelimit.
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
def get_integer(prompt): | |
return int(input(prompt)) | |
size= get_integer("Enter the number of numbers you want in the fibonacci sequence: ") | |
def fib(size): | |
a,b = 0,1 | |
list=[a] | |
while len(list) < size: | |
a,b = b,a+b | |
list.append(a) | |
# list.append(b) | |
return list | |
print(fib(size)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment