Python Modules
Last updated
"""
For shorts, a module is simply a python file
The python file can contain classes, functions and even variables
And the classes, functions or variables can be imported to other files
"""
from circle import area_of_a_circle # import area_of_a_circle function
from rectangle import area_of_a_retangle
# called the area of a circle function
print(area_of_a_circle(10))
# called the area of a rectangle function
print(area_of_a_retangle(5, 5))def sayHi(name):
return f'Hi, {name}'def sayHello(name):
return f'Hello, {name}'# import sayHi function
from functions.sayHello import sayHello
from functions.sayHi import sayHi
print(sayHello("Marv"))
print(sayHi("Joy"))