1
Alarm Clock with Python
Video to Audio Converter with Python
Story Generator with Python
Play Rock, Paper, and Scissors with Python
Fidget Spinner Game
Animal Quiz Game
Age and Gender Detection with Python
The Game of Life
2
Alarm Clock with Python
Before writing the program you should know that you also need an
alarm tone that will ring at the time of the alarm. Now as we are ready
with the libraries and the alarm song, let’s see how to write a program
to create an alarm clock with Python.
3
Video to Audio Converter with Python
Converting videos to audio files might seem like an odd decision, but it
can come in handy in specific cases. It is most often used to record the
soundtrack of videos or to extract other audio tracks from videos where
you are only interested in the sound.
4
Story Generator with Python
Generate a random story every time the user runs the program. I will
first store the parts of the stories in different lists, then the Random
module can be used to select the random parts of the story stored in
different lists:
5
Play Rock, Paper, and Scissors with Python
To create the Rock, Paper and Scissors game with Python, we need to
take the user’s choice and then we need to compare it with the
computer choice which is taken using the random module in Python
from a list of choices, and if the user wins then the score will increase
by 1:
6
Fidget Spinner Game
The logic of the game is that the turns will keep increasing as you press
the space bar, and it will reduce its speed and stop at a point where
you stop pressing the space bar.
To create a game with Python based on the above logic of a fidget
spinner I will use the Turtle module in Python:
7
Animal Quiz Game
Now is the time to create your quiz! First, then create the questions and
the answer verification mechanism. Next, add the code that gives the
player three attempts to answer each question:
8
Age and Gender Detection with Python
Now let’s get started with the task of Age and Gender detection using
the Python programming language. I will first start with writing the code
for detecting faces because without face detection we will not be able
to move further with the task of age and gender prediction.
You can download the necessary OpenCV pre-trained models that you
will need in the task of age and gender detection. Now after importing
the OpenCV module in your python file, you can get started with the
code below.
9
The Game of Life
The game uses a rectangular grid of cells of infinite size in which each
cell is empty or occupied by an organism. It is said that occupied cells
are alive, while empty ones are dead. The game is played over a
specific period, with each turn creating a new “generation” based on the
arrangement of living organisms in the current configuration.
The status of a cell in the next generation is determined by applying
the following four basic rules to each cell of the current configuration:
If a cell is alive and has two or three living neighbours, the cell stays
alive in the next generation.
A living cell that has no living neighbours or only one living neighbour
dies of isolation in the next generation.
A living cell that has four or more living neighbours dies from
overpopulation in the next generation.
A dead cell with exactly three living neighbours results in birth and
becomes alive in the next generation.
Implementing The Game of Life with Python
The Game of Life begins with an initial setup provided by the user.
Successive generations are created by applying the set of rules
simultaneously to each cell in the grid. Interesting patterns can develop
as the population of organisms changes, increases, or eventually
disappears. Now let’s see how to implement the game of life with
Python:
10
11
Follow:
LinkedIn - Rajesh Kumar
Twitter - Rajesh Kumar