create and use a python library in a class code example
Example 1: how to make a class in python
class Person:
def __init__(self, _name, _age):
self.name = _name
self.age = _age
def sayHi(self):
print('Hello, my name is ' + self.name + ' and I am ' + self.age + ' years old!')
p1 = Person('Bob', 25)
p1.sayHi()
Example 2: importing modules with package in python
from pakage_name.module_name import function_name
from pakage_name import module_name
Example 3: package in python
A package is basically a directory with Python files and a file with the name __init__.py