This is lesson 1 of learning Python from scratch. You can check the codes and do practice. This project demonstrates the use of basic Python concepts, external modules, and built-in modules through simple and practical examples.
📌 Features 😂 Generate random jokes using pyjokes 🔊 Convert text to speech using pyttsx3 📂 Display directory contents using os module ✨ Print a classic poem (Twinkle Twinkle Little Star) 🔢 Print multiplication table of 5 🧩 Modules Used 🔹 External Modules
These need to be installed manually:
pyjokes → For generating random jokes pyttsx3 → For text-to-speech conversion 🔹 Built-in Modules
Already available in Python:
os → For interacting with the operating system ⚙️ Installation
Make sure you have Python installed, then install required modules:
pip install pyjokes pyttsx3 🚀 How to Run Clone the repository: git clone cd Run the Python script: python your_script_name.py 📁 What the Code Does
- 😂 Print a Joke
Uses pyjokes.get_joke() to display a random joke.
- 📜 Print Poem
Prints the famous Twinkle Twinkle Little Star poem using multi-line strings.
- 🔢 Multiplication Table
Prints the table of 5 using basic arithmetic operations.
- 📂 Directory Listing
Defines a function:
print_directory_contents(directory) Lists all files and folders in a given directory Uses os.scandir() 5. 🔊 Text-to-Speech
Uses pyttsx3 to speak the directory path aloud.
📸 Sample Output Why do programmers prefer dark mode? Because light attracts bugs!
Twinkle, twinkle, little star...
5 * 1 = 5 5 * 2 = 10 ...
Contents of directory '.': File: main.py Directory: assets