DEV Community

Cover image for Beginner Python Project : Part 3
Hillary Nyakundi
Hillary Nyakundi

Posted on • Edited on

1

Beginner Python Project : Part 3

In this third post on my preferred python beginner projects I continue by building a jokes app using python. Yap it tells jokes because it has text to speech conversion.

It fetches the jokes from an API

To get started we will need first have a code editor :
either * pycharm * VScode or * Sublime

  • Next step create a file and give a .py extension
  • Now you will have to install pyjokes: pip install pyjokes
  • Next you will need a text to speech conversion, you will have to install pyttxs3: pip install pyttxs3
  • After doing the basics you can now write the code below and run it
import pyjokes
import pyttsx3

engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
rate = engine.getProperty('rate')
engine.setProperty('rate', rate+-20)

def speak(audio):
    engine.say(audio)
    engine.runAndWait()

def joke():
    speak(pyjokes.get_joke())

if __name__ == "__main__":
    joke()
Enter fullscreen mode Exit fullscreen mode

Feel free To add your python scripts to my GitHub repo
Also Give me a follow on dev

GitHub: larymak
Twitter: larymak1

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay