10 Interesting Python
Programs with Code
Python programs explained in detail
Python programs have many modules and packages, which helps
with efficient programming. Understanding these modules and
proper usage is important. In this article, a few interesting
modules and packages are used for programming.
1. Python Fake Information Generator
Create a program to generate fake data like name,
email, or detailed fake profile with all the information
about a person.
Faker is a python package, which can be installed by using pip
install Faker in the terminal. Each time you run this program
faker generator, it will result in different random data.
Output:
Note: Try checking all the methods in Faker
using dir(Faker())syntax. There are numerous interesting
methods like fake text, fake credit card numbers, and many more.
2.Handwritten Text Image
A program to change the given text into handwritten
notes.
For this, the program package pywhatkit is required, which can be
installed using pip install pywhatkit. There are various features in
this package, like sending WhatsApp messages and searching on
Google or Youtube.
Output:
Note: Output is saved as an image file at the source of the python
file.
3. Shut down your Computer
A python program to shut down your computer.
For this program OS library, which can be installed using pip
install os. You can shut down, restart, and even set a timer for
shutdown or restart with this package.
Note: Make sure to save and close all documents before executing
this program. After running this program which will cause the
computer to shut down, the unsaved data might be lost.
4.Print Calendar
A program to print a calendar of the specified month
and year
Python has a built-in module, the calendar, which helps to access a
record of the calendar. There are many methods in this module, in
this program, we are trying to print the calendar of the specified
month of a given year.
Output:
Note: Try printing a full-year calendar
with calendar.calendar(year)and check for a leap year
with calendar.isleap(year).
5.Draw a Pie Chart
A program to present the monthly expenses in a pie
chart with percentage.
In this program, we use matplotlib to represent the pie chart. This
library can be installed using pip install matplotlib. With this
module, many animated statics and interactive visuals can be
programmed in python.
Output:
Note: matplotlib library is vast and has numerous methods to plot
bars, graphs, statics, pie-chart, style sheet, axes grid, and many
more interactive visuals.
6.Alert Box with Python
A program to display an alert box with a message.
This program, pyautogui is used for displaying the alert box. It can
be installed by using pip install pyautogui. This module has many
methods and it is also commonly used to control the mouse and
keyboard with a python program.
Output:
Note: Alert message is only displayed when you try to divide a
number by 100.
7. Text to Audio
In this program, we try to change text into an audio
To change the text to audio, install a module with pip install
pyttsx3. This library has many modules with which you can try
changing the voice, volume, and speed rate of the audio.
Note: Output is a female voice pronouncing the given input to the
engine.
8. Take a Screenshot
A program to take a screenshot of the screen with
python
This program, pyautogui is used for displaying the alert box. It can
be installed by using pip install pyautogui. This module has many
uses, we have also used this to display an alert message box.
Note: The output file screenshot is saved at the python source file.
Try delayed screenshot by using time.sleep() syntax.
9. Internet Speed Check
A program to check the internet upload and download
speed with python
In this program, to check the internet speed we use
the speedtest module. To install this package use pip install
speedtest-cli syntax.
Output:
10.Graphics with Python
A program to make spiral graphics with turtle python
In this program, we have used Python Turtle to draw a spiral
diagram. To install the turtle library, use pip install PythonTurtle.
Python Turtle is used for visual graphics to draw any shape and
design with colors.
Output:
Level Up Coding
Coding tutorials and news.