CWP Utils
A reusable Python utility package built as part of the CWP Python Expert Programming Week 2 Project.
This package contains reusable utility functions that can be imported into any Python project to perform common tasks such as mathematical calculations, string manipulation, and data validation.
Project Structure
Reusable Utility Package/
│
├── cwp_utils/
│ ├── __init__.py
│ ├── math_utils.py
│ ├── string_utils.py
│ └── validation.py
│
├── examples.py
├── README.md
├── pyproject.toml
└── LICENSE
Features
Math Utilities
- Calculate BMI
- Calculate Grade
- Check if a number is Prime
- Format Currency
String Utilities
- Capitalize Words
- Generate Random Passwords
- Reverse Text
Validation Utilities
- Validate Email Address
- Validate Phone Number
- Validate Password
Installation
Clone the repository:
git clone https://github.com/your-username/cwp-utils.git
Navigate into the project folder:
cd cwp-utils
Usage
Import any function directly from the package.
from cwp_utils import (
calculate_bmi,
calculate_grade,
is_prime,
format_currency,
capitalize_words,
generate_password,
reverse_text,
validate_email,
validate_phone,
validate_password
)
Example
print("\n Calculate Grsde")
print(calculate_grade(50))
print(calculate_grade(90))
print("\n calculate BMI")
print(calculate_bmi(75, 6.6))
print(calculate_bmi(85, 5.6))
print("\n Is prime number")
print(is_prime(2))
print(is_prime(12))
print("\n Formart currency")
print(format_currency(2000))
print(format_currency(20000000))
print("\n Capitalize word")
print(capitalize_words("faith kalu onyeani"))
print("\n Generate password")
print(generate_password(8))
print("\n Reversed text")
print(reverse_text("Faith"))
print("\n Validate Email")
print(validate_email("fkaluonyeani@gmail.com"))
print(validate_email("fkaluonyeani@gmail"))
print("\n Validate Phone")
print(validate_phone("09161027545"))
print("\n Validate Password")
print(validate_password("Faith123"))
Example Output
Calculate Grsde
Grade is 50 you scored C
Grade is 90 you scored A
calculate BMI
Your weight is: 75kg, Your height is: 6.6m, Your BMI: 1.7217630853994492
Your weight is: 85kg, Your height is: 5.6m, Your BMI: 2.71045918367347
Is prime number
True
False
Formart currency
₦2,000.00
₦20,000,000.00
Capitalize word
Faith Kalu Onyeani
Generate password
nsLAU9N4
Reversed text
htiaF
Validate Email
True
False
Validate Phone
True
Validate Password
True
Note: The generated password will be different each time because it is randomly generated.
Skills Learned
This project helped me understand and practice:
- Creating Python modules
- Building Python packages
- Using
__init__.py - Importing functions between modules
- Writing reusable functions
- String manipulation
- Mathematical operations
- Data validation
- Project organization
- Package configuration using
pyproject.toml - Creating project documentation with Markdown
Technologies Used
- Python 3
- Standard Python Libraries
Author
Faith Kalu Onyeani
GitHub: https://github.com/beautifulone0
License
This project is licensed under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cwp_utils-1.0.0.tar.gz.
File metadata
- Download URL: cwp_utils-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50496efa1fd7f7573bec629deec4aa219083aee7ccb2ddb889beda00f982839c
|
|
| MD5 |
73ca833490194338cd93af53561ae986
|
|
| BLAKE2b-256 |
43e287725ce83a463dbef69028aaadc22f8d01a1716bdc47cc2c8f1015a2febf
|
File details
Details for the file cwp_utils-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cwp_utils-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04ef7a876a7e77f29c466f4bfc949356b7183f731f0df8585510f116ea05d0ce
|
|
| MD5 |
9e3c0b185fb5a657cda5820cfbcc44c5
|
|
| BLAKE2b-256 |
9c1525a065e2d44f67e251d68c706bad0bde3ae35866b12ebe45ffc6b810c19b
|