#WHAT IS IMPORT ??
'''In Python, we get access to using a module by importing it .
to do this we use the keyword import '''

#HOW IMPORT FUNCTION WORKS??
'''when we write a module name with the keyword import , it starts searching for the module name along with the
extension .py after finding the file , it will import it into our program . we can see the path in which python tries
to find the module by importing sys and then printing the path'''

# WHY NOT TO USE THE SAME NAME OF UR FILE AND THE MODULE U R PLANNING TO IMPORT IN THE FILE??

'''when we try and import a module , the python interpreter begins its search from the directory you are working in
and it finds the same file you are working on as it has the same name . hence the module does not works as expected '''

import sys
print(sys.path)

''' we can use modules that we have created and pass values in them .
for example here recursion was created by me

code for recursion .

def fibonacci1(pos):# defining a function
if pos ==1:
return 0 # defining the base case
elif pos ==2:
return 1 # defining the base case
else:
return fibonacci1(pos-1)+fibonacci1(pos-2) # using the formula
print(fibonacci1(int (input("enter a number")) ))
'''
import recursion
print(recursion.factorial1(25) )


'''each time a module is called . all the functtions in the module are executed .
(except __name__==__main__ which is explained in another article )

There are two methods to import and use functions or variables after importing:
1. we can import the entire module like

syntax : import pandas
here we have imported the entire module

2. we can import only a part of the module
syntax: from flask import Flask

note: we can also rename a module for our convenience

syntax : import pandas as pd

We can not access it using pandas keyword; instead, we have to use pd or the compiler will show an error. This case comes in handy when the module name
is difficult or lengthy, and we have to use a module again and again to call its functions. '''