**************************************************
Python Core PlayList : • Lesson - 01 : Python3 - What is python
Python Advanced PlayList : • Lesson - 46 : Python Advanced - Pytho...
**************************************************
Python Modules : Creating module:
Python module is a normal python file which can store function, variable, classes, constants etc. Module helps us to organize related codes . For e.g math module in python has mathematical related functions.
Creating module :
Create a new file called mymodule.py and write the following code.
foo = 100
def hello():
print("i am from mymodule.py")
as you can see we have defined a global variable foo and a function hello() in our module. Now to use this module in our programs we first need to import it using import statement like this
import mymodule
now you can use variable and call functions in the mymodule.py using the following code.
import mymodule
print(mymodule.foo)
print(mymodule.hello())
Sample Projects : https://github.com/SadaLearningHub1/P...