Skip to content

Instantly share code, notes, and snippets.

@dbc2201
Created November 26, 2018 19:05
Show Gist options
  • Save dbc2201/2b9b430e7259a668f7fecdc44ae1ea8c to your computer and use it in GitHub Desktop.
Save dbc2201/2b9b430e7259a668f7fecdc44ae1ea8c to your computer and use it in GitHub Desktop.
a python program to print fibonacci series
def fibonacci_sequence(num1):
list1 = []
if num1 == 0:
list1 = list1
elif num1 == 1:
list1.append(0)
elif num1 == 2:
list1.extend([0, 1])
else:
list1.extend([0, 1])
for i in range(2, num1):
list1.append(list1[i - 2] + list1[i - 1])
print(list1)
fibonacci_sequence(0)
fibonacci_sequence(2)
fibonacci_sequence(3)
fibonacci_sequence(8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment