Skip to content

Instantly share code, notes, and snippets.

@iswarup
Created June 21, 2018 01:27
Show Gist options
  • Save iswarup/6807a96f556332ff8edc168b0f4c9030 to your computer and use it in GitHub Desktop.
Save iswarup/6807a96f556332ff8edc168b0f4c9030 to your computer and use it in GitHub Desktop.
Fibonacci Function with user sizelimit.
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