A fun Python package that provides jokes for developers
Project description
Joke Center 🎭
A simple and extensible Python library for managing and retrieving jokes by category.
🚀 Features
- Get random jokes by category
- Add and delete jokes dynamically
- Retrieve jokes across all categories
- List available categories
- Get multiple jokes at once
- Built-in statistics support
- Fully tested with
pytest
📦 Installation
Install via pip:
pip install joke-center-wszms384
🔧 Usage
Basic Example
import joke_center
# Get a joke
print(joke_center.get_joke("programming"))
# Add a joke
joke_center.add_joke("programming", "Debugging is like being the detective in a crime movie where you are also the murderer.")
# Get random joke from all categories
print(joke_center.get_random_joke())
# List categories
print(joke_center.list_categories())
📚 API Reference
get_joke(category="programming")
Return a random joke from a category.
add_joke(category, joke)
Add a new joke.
- Returns error if joke is empty
delete_joke(category, joke)
Delete a joke from a category.
list_categories()
Return all available categories.
get_random_joke()
Return a random joke from all categories.
get_all_jokes(category)
Return all jokes in a category.
get_multiple_jokes(category, n=1)
Return multiple random jokes.
get_stats()
Return statistics:
{
"total_categories": 3,
"total_jokes": 6
}
Project details
Release history Release notifications | RSS feed
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 joke_center_wszms384-0.3.2.tar.gz.
File metadata
- Download URL: joke_center_wszms384-0.3.2.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc22b00e8393eec06383d0dae67c894243cc0a0d6eddc1479b92de9f107c4d6
|
|
| MD5 |
cc81c9975f0f69d929d2ae7aea9d8728
|
|
| BLAKE2b-256 |
dfcbef0f632d1334a750a8975c0ff5a4e90dafa402fa588137701e5801a3a17d
|
File details
Details for the file joke_center_wszms384-0.3.2-py3-none-any.whl.
File metadata
- Download URL: joke_center_wszms384-0.3.2-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a683b39dbf69781e11a673a91127f7ea6139f9b535b9c29d93e34bf45267954
|
|
| MD5 |
9686e4ab6256780a3bad7f6b6a55bc25
|
|
| BLAKE2b-256 |
b61bd371481b98b4e3260713f939ef8bb22a1a3d262135036eccd99d65e6f31b
|