Make Your Own Python Libraries in 5 Minutes
A Python Library is a pack of interconnected modules. It encompasses a bunch of code, It can be used for a different program. Whenever We need this bunch of code can be used in our programs or projects.
Python Libraries be involved in vital responsibility in the domain of Data Science, Data Visualization, Machine Learning, Data Manipulation, and many more.

Let’s see how we can create our own module.
Create Module
I am going to create Permutation and Combination formula as a module.
Defining a function for calculating Permutation
With the help of permutation, We can calculate the number of ways a collection of elements can be arranged.
Let us consider 10 numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
The number of different 6-digit-PIN which can be formed using these 10 numbers is 151200. P(10,6) = 151200.
This is a simple example of permutations.
import mathdef permutation(n,r):
permu=math.factorial(n)/math.factorial(n-r)
return permupermutation(10,6)
Output:
151200.0
Defining a function for calculating Combinations
A combination is a number of possible grouping in a collection of items where the order doesn’t matter.
Combination: Picking a team of 4 people from a group of 20 .(20,4) is 4845
def combination(n,r):
combi=math.factorial(n)/(math.factorial(r)*(math.factorial(n-r)))
return combicombination(20,4)
Output:
4845.0
Creating Module
To create a module we have to save the Python file with the required library name.
Adding Permanent Search Path in Anaconda Environment
In order to import our completed modules we have to add our file path in Anaconda Environment
!conda develop HERE_TYPE_THE_LIBRARY_PATH
Example:
!conda develop /Users/amsavallimylasalam/Downloads
Output:
path exists, skipping /Users/amsavallimylasalam/Downloads
completed operation for: /Users/amsavallimylasalam/Downloads
Import Modules
Import statement is used to import the module to make use of the function in a module.In this example I am importing Permutation Combination module to do a function of Permutation and Combination .

Conclusion
I hope you have gained solid understanding of Creating and Importing Modules in python Library..