1. Example: Using the Dummy Python Package
Demomstration
This example demonstrates how to use the dummy Python package located in lib/py_pkg.
from py_pkg import math_utils, string_utils, module
# Math utilities
print("PI:", math_utils.PI)
print("Square of 4:", math_utils.square(4))
calc = math_utils.Calculator()
print("Add:", calc.add(2, 3))
print("Divide:", calc.divide(10, 2))
# String utilities
print(string_utils.DEFAULT_GREETING)
print(string_utils.shout("hello world"))
fmt = string_utils.Formatter()
print(fmt.surround("example", "#"))
Output Explanation
When you run this code, you will see output similar to:
PI: 3.14159
Square of 4: 16
Add: 5
Divide: 5.0
Hello
HELLO WORLD
#example#
PI: 3.14159prints the value ofmath_utils.PI.Square of 4: 16is the result ofmath_utils.square(4).Add: 5is the result ofcalc.add(2, 3).Divide: 5.0is the result ofcalc.divide(10, 2).Hellois the value ofstring_utils.DEFAULT_GREETING.HELLO WORLDis the result ofstring_utils.shout("hello world").#example#is the result offmt.surround("example", "#").