In Python programming, you cannot use a module without calling that particular module into the python IDE.
IDE stands for Integrated Development Environment. It is the environment or area where you type in your source code and the code is then interpreted into a target code for your computer to understand it in order to do what you are instructing it to do.
To import a module, just make sure that module is in your library and then import it.
I.e to use the maths module, you can do this;
Import math
You can then use any function in the math module by calling that function e.g
To use log function, we call it like this
math.log(10) because we have imported the math module this will work, otherwise it won't work.
Another eg is mathplotlib.pyplot
eg import mathplotlib.pyplot as plt
plt.plot(x,y)
In this example, we assigned the mathplotlib.pyplot as plt, therefore anytime we use plt in our code, it is the matplotlib.pyplot
Thanks for reading
No comments:
Post a Comment