5 Interesting Python Projects With Code for Beginners!

5 INTERESTING PYTHON PROJECTS WITH CODE FOR BEGINNERS:- Python is a versatile language that can be used for a variety of purposes. Here are five interesting Python projects with code to get you started.

Introduction To Python

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum in 1989. Python is most popular for its ease of use and readability, as well as its powerful data structures, management tools, and built-in scientific libraries.

So today in this article I’ll tell you 5 INTERESTING PYTHON PROJECTS WITH CODE FOR BEGINNERS!

Let’s start with the first one.

1. AudioBook Using Python

For AudioBook generation using python, we are going to use a python module called Pyttsx3, it is a a text-to-speech conversion library in Python.

So Install it using this command: pip install pyttsx3.

Link: https://pypi.org/project/pyttsx3/

AudioBook Using Python

Program

import pyttsx3

book=open(r"book.txt")

book_text=book.readlines()

engine = pyttsx3.init()

for i in book_text:

engine.say(i)

engine.runAndWait()

Here at the 2nd last line of the code you can Write Your Own Text, that you want to Hear.

Changing Voice , Rate and Volume Of The AudioBook

Program

"import pyttsx3
engine = pyttsx3.init() # object creation

""" RATE"""
rate = engine.getProperty('rate') # getting details of current speaking rate
print (rate) #printing current voice rate
engine.setProperty('rate', 125) # setting up new voice rate


"""VOLUME"""
volume = engine.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print (volume) #printing current volume level
engine.setProperty('volume',1.0) # setting up volume level between 0 and 1

"""VOICE"""
voices = engine.getProperty('voices') #getting details of current voice
#engine.setProperty('voice', voices[0].id) #changing index, changes voices. o for male
engine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female

engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()

"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()"
https://pypi.org/project/pyttsx3/#:~:text=import%20pyttsx3%0Aengine%20%3D%20pyttsx3.init()%20%23%20object,Hello%20World%27%2C%20%27test.mp3%27)%0Aengine.runAndWait()

2. Extract MP3 From MP4 Using Python

With the help of Python You can Easily Extract MP3 From MP4, so in order to extract MP3 from MP4, we need to install a Module called “moviepy”. MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 2.7+ and 3 (or only Python 3.4+ from v.1.0).

So Install it using the Command:- pip install moviepy

Link:- https://pypi.org/project/moviepy/

Extract MP3 From MP4 Using Python

Program

import moviepy

import moviepy.editor

# Put your file path in here

video = moviepy.editor.VideoFileClip("")

audio = video.audio

audio.write_audiofile( 'new_audio.mp3')

3. Merge Multiple PDF Using Python

Sometimes, we needs merge Multiple PDF, so in order to do it Using Python we need to install a Module called PyPDF2, It is A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files.

So Install it using command:- pip install PyPDF2

Link:- https://pypi.org/project/PyPDF2/

Merge Multiple PDF Using Python

Program

from PyPDF2 Import PdfFileMerger

import os

#var = os.getcwd() For extracting from enother folder

merger = PdfFileMerger()

for items in os.listdir():

if items.endswith('.pdf'):

merger.append(items)

merger.write("Final_pdf.pdf")

merger PdfFileMerger()

with open(originalFile, 'rb') as fin:

merger.append(PdfFileReader(fin))

os.remove(originalFile)

merger.close()

4. Password Protect Pdf Using Python

Sometimes we needs to send some sensitive information like Aadhaar card, Pan Card, or any other important Documents, and we don’t want that everyone can Read that file, so to do that we can encrypt that PDF Using Python.

So in order to do it Using Python we need to install a Module called PyPDF2, It is A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files.

So Install it using command:- pip install PyPDF2

Link:- https://pypi.org/project/PyPDF2/

Password Protect Pdf Using Python

Program

from PyPDF2 import PdfFileWriter, PdfFileReader

import getpass

pdfwriter PdfFileWriter()

pdf PdfFileReader("1.pdf")

for page_num in range(pdf.numPages):

pdfwriter.addPage(pdf.getPage(page_num))

passw=getpass.getpass (prompt='Enter Password: ')

pdfwriter.encrypt(passw)

with open('ho.pdf', 'wb') as f:

pdfwriter.write(f)

5. Voice Recorder Using Python

Last but not the least Python Project is to Create A Voice Recorder Using Python, so to it using python you neds to install a Module called “sounddevice”. This Python module provides bindings for the PortAudio library and a few convenience functions to play and record NumPy arrays containing audio signals.

The sounddevice module is available for Linux, macOS and Windows.

Install It Using the Command:- pip install sounddevice

Link:- https://pypi.org/project/sounddevice/

Voice Recorder Using Python

Program

import sounddevice

from scipy.io.wav file import write

fs=44100 #sample_rate

second=int(input("Enter the time duration in second: ")) #enter your required time..

print("Recording....\n")

record_voice-sounddevice.rec(int(second fs), samplerate-fs, channels=2)

sounddevice.wait()

write("out.wav", fs, record_voice)

print("Finished...\nPlease Check it...")

End Notes:

Python is very easy to learn language because of its easy syntax. Here we discussed only basic python projects i.e. 5 INTERESTING PYTHON PROJECTS WITH CODE FOR BEGINNERS . I hope you find this article i.e 5 INTERESTING PYTHON PROJECTS WITH CODE FOR BEGINNERS helpful. Let’s connect on Instagram.

Thanks for reading if you reached here :).

Happy coding!

Also Read

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: