Skip to main content


Get a Joke in Python

Generate Joke with Python

👇Get a joke

Click the "get joke" button

Pyjokes - is a python library / module for one line joke program based on programmers. You can get funny one-liner random jokes at every run also available in following "languages" & "categories".

Supported Languages By Pyjokes

  • English — ‘en’
  • Spanish — ‘es’
  • Italian — ‘it’
  • German — ‘de’
  • Galician — ‘gl’
  • Basque — ‘eu’

Categories Included In Pyjokes

  • For geeky jokes -’neutral’ (It is chosen by default)
  • For Chris Norris Jokes — ‘chuck’.
  • If you want all type of jokes — ‘all’
  • There is one more category known as ‘twister’ which only works for the German Language (‘de’) and mostly includes tongue twister.

Read the documentation available on https://pyjok.es for more info.

:::Lets Code:::

Install pyjokes if you haven't 

pip install pyjokes

This Program will give you one-liner Joke

#pip install pyjokes

# importing module
import pyjokes

# we want joke in english so 'en', category = all
joke = pyjokes.get_joke(language='en', category= 'all') 

#display a joke
print(joke)

This Program will give do the same but only difference is we have changed the catagory

# importing module
import pyjokes

# we want joke in english so 'en', changing category to neutral
joke = pyjokes.get_joke(language='en', category= 'neutral')

#display a joke
print(joke)

This Program will give you multiple jokes all at once depends on you number range

# importing module
import pyjokes

# we want joke in english so 'en', category neutral
jokes = pyjokes.get_jokes(language='en', category= 'neutral')

# we want some jokes atleast 5 one after another
for i in range(5):
    print(i+1,".",jokes[i])

Enjoy!!!

Comments



🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍

Popular Posts

Python underline string, Python underline text, Underline python print

Python pip - Installing modules from IDLE (Pyton GUI) for python 3.7

Top 40 Python - String Processing in Python | Working with String in Python

Python Program - When was I born? / Date of Birth / MY BIRTHDAY (using Python3+)

Top 11 Essential Python Tips and Tricks





Subscribe to our Channel


Follow us on Facebook Page

Join our python facebook groups



Join us on Telegram