The Alexa APIs for Python consists of python classes that represent the request and response JSON of Alexa services.
The ASK Software Development Kits (SDKs) include development tools and libraries that give you access to Alexa features. These SDKs are available in Node. js, Java, and Python. Alternatively, you can develop your skill in any language and accept requests from and send responses to the Alexa service.
Pyjokes Library
Pyjokes is a python library for one line jokes for programmers (jokes as a service). You can get funny one-liner, mostly related to programming.
Install and Importing Library
_#install on command line _
pip install pyjokes
import in python idle/editor
import pyjokes
1)
get_joke()
It only returns one joke at a time. It is generated randomly.
Parameters - It has two parameters language and category.
Return Type - It returns string type (str).
joke1 = pyjokes.get_joke (language='en', category= 'all') print (joke1)
#output: any random joke
2)
get_jokes()
It returns a list of jokes.
Parameter- The parameters are the same as above- language and category.
Return type- *It returns a list.
jokes= pyjokes.get_jokes (language='en', category=
'neutral')
for i in range(5):
print (i+1, ".", jokes[i])
#output: list of jokes
Parameter: Category
βFor geeky jokes -'neutral' (It is chosen by default)
β’ For Chris Norris Jokes - 'chuck'.
β’ If you want all type of jokes - 'all'
Top comments (0)