Horje
fibbonachi python Code Example
fibonacci series in python
#Recursive Solutions
def fibo(n):
  if n<=1: return 1
  return fibo(n-1)+fibo(n-2)

fibo(5)
#OUTPUT:
#120
fibbonachi python
#Learnprogramo
Number = int(input("How many terms? "))
# first two terms
First_Value, Second_Value = 0, 1
i = 0
if Number <= 0:
print("Please enter a positive integer")
elif Number == 1:
print("Fibonacci sequence upto",Number,":")
print(First_Value)
else:
print("Fibonacci sequence:")
while i < Number:
print(First_Value)
Next = First_Value + Second_Value
# update values
First_Value = Second_Value
Second_Value = Next
i += 1




Python

Related
python messaging networking Code Example python messaging networking Code Example
program to demonstrate encapsulation in python Code Example program to demonstrate encapsulation in python Code Example
Use Python to calculate (((1+2)*3)/4)^5 Code Example Use Python to calculate (((1+2)*3)/4)^5 Code Example
python use var in another function Code Example python use var in another function Code Example
getting vocab from a text file python Code Example getting vocab from a text file python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8