How to program to print the Fibonacci series using modules in python


How to program to print the Fibonacci series using modules in python.


  1. File 1: Fibonacci.py

    def fib(n):
     a=0
     b=1
     c=0
     print (a," ",b,end=" ")
     while(c<=n):
     c=a+b
     print(c,end=" ")
     a=b
     b=c

    File 2: Module.py

    import fibonacci
    num=int(input("Enter the series limit"))

    fibonacci.fib(num)

Output:-



Post a Comment

0 Comments