Skip to content

crissyg/Programming_Jokes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Programming Jokes Fetcher

A simple Python script that fetches and displays 3 programming jokes using an API, JokeAPI, and HTTP requests.


🎯 Features

  • Fetches jokes from the JokeAPI Programming category
  • Supports filtering out jokes containing specific keywords
  • Displays up to 3 jokes before stopping
  • Easy to customize for different joke types or categories

πŸ› οΈ Requirements

  • Python 3.x
  • requests library (pip install requests)

πŸš€ How to Use

  1. Clone or download this repository.
  2. Open a terminal and navigate to the project directory.
  3. Run the script:
    python jokes.py
    
  4. Enjoy your programming jokes!

πŸ“ Customization

  • Change the joke category:
    Edit the url in fetch_joke() to use a different category (e.g., "https://v2.jokeapi.dev/joke/Any").
  • Filter out keywords:
    Add keywords to the exclude_keywords list in the main loop (e.g., ['sql', 'python']).
  • Change the joke type:
    Set joke_type to 'twopart' for two-part jokes.

πŸ“„ Example Output

Joke #1:
Category: Programming
Type: single
Joke: Why do programmers prefer dark mode? Because light attracts bugs.

Joke #2:
Category: Programming
Type: single
Joke: Why do Java developers wear glasses? Because they can't C#.

Joke #3:
Category: Programming
Type: single
Joke: How many programmers does it take to change a light bulb? None, that's a hardware problem.

Finished fetching 3 programming jokes!

🀝 Contributing

Feel free to fork, modify, or submit pull requests!


Enjoy the jokes!


About

This script fetches programming jokes from JokeAPI using HTTP requests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages