Let’s add a touch of humor to your Python journey with our project on generating random jokes. We’ll walk you through the process and provide you with the source code, so you can create a fun and entertaining application that keeps the laughs coming.
Requirements
pip install pyjokes
import pyjokes
# Fetch the joke
joke1 = pyjokes.get_joke(language="en", category="all")
# Display the joke
print(joke1,"\n")
# Different category
joke2 = pyjokes.get_joke(language="en", category="neutral")
# Display the joke
print(joke2,"\n")
# Fetch multiple jokes
jokes = pyjokes.get_jokes(language="en", category="neutral")
for i in range(5):
print(i+1,".",jokes[i],"\n")
Latest posts by ideasorblogs (see all)
- Create a Python program to find the DNS record - November 26, 2023
- Billing system using Python project with source code - November 20, 2023
- Python Programming questions with real examples PDF & slides - October 31, 2023