Gaurav Sharma — Published On July 18, 2021 and Last Modified On May 11th, 2023
Beginner Programming Project Python

Introduction

Beginners, when starting programming, often get bored if they do not get a chance to play with some interesting code. So, in this article, I have explained three python project ideas with Code that is a suitable proposition for python projects for beginners. Beginner programmers can try to implement these projects to learn python and get their hands dirty in the Python language.

Prerequisite:

This tutorial requires you to install Python 3 and Pip3 on your computer. To install Python and python libraries, In case you are unfamiliar with the basics of Python, do have a look at our free python tutorial of Introduction to Python. For other tutorials on data science and machine learning, you can visit https://courses.analyticsvidhya.com/.

Let’s start with the first of the simple python projects.

Learning Objectives

  • These beginner-level python projects will help boost your confidence in Python coding.
  • These interactive fun projects are sure to build your interest in Python coding and teach you a few tricks.
  • It helps in structured thinking and building your algorithm to build projects.

This article was published as a part of the Data Science Blogathon.

Implementation of QR Code Generation Project Using Python

This is one of the easiest python project projects. QR code stands for Quick Response Code. QR codes may look simple, but they can store lots of data. The QR code allows the user to access information instantly regardless of how much data they contain when scanned. That is why they are called Quick Response Codes.

These are being used in many scenarios these days. It first appeared in Japan in 1994. QR codes can be used to store(encode) lots of data and that too of various types. For example, they can be used to encode:

  1. Contact details
  2. Facebook ids, Instagram ids, Twitter ids, WhatsApp ids, and more.
  3. Event Details
  4. Youtube links
  5. Product details
  6. Link directly to download an app on the Apple App Store or Google Play.
  7. They are also being used in digital transactions by simply scanning QR codes.
  8. Access Wi-Fi by storing encryption details such as SSID, password, and encryption type.
QR code Generation | Python projects

Image Source: assetinfinity.com

This list goes on….!

We just saw some advantages of QR codes. Now we will learn here how we can generate QR codes in Python.

For QR code generation using python, we are going to use a python module called QRcode.
Link: https://pypi.org/project/qrcode/

Install it using this command: pip install qrcode

We will generate a QR Code to encode the youtube link and explore more. QR code generation is simple. Just pass the text, link, or any content to the ‘make’ function of the QRcode module.

Python Code:

On executing this code, the output image is:

Code output | Python projects

You can scan and verify it.

You can see it’s just 3 lines of code to generate this QR Code. One more thing to mention is that it’s not necessary that you always have to give a link to qrcode.make() function. You can even provide simple text.

For example:

You can encode: India is a country with many religions. I love India.

Let’s try it out:

import qrcode
img = qrcode.make("India is a country with many religions. I love India.")
img.save("youtubeQR.jpg")

Output QR Code for this text is:

Output QR 2 | Python projects

Scan it from your mobile, and you will get the content.

So this is the one part that involves generating a QR Code and scanning it. But what if we want to read this QR Code, i.e., now we want to know what was encoded in the QR Code without scanning it? For this, we will use OpenCV. OpenCV is a library of programming functions focused on real-time computer vision tasks.

Install opencv: pip install opencv-python

Code to decode a QR code back to know the original string.

import cv2
d = cv2.QRCodeDetector()
val, _, _ = d.detectAndDecode(cv2.imread("myQRCode.jpg"))
print("Decoded text is: ", val)

Output:

India is a country with many religions. I love India.

This QRcode module in python provides many other functionalities. Go and try those yourself by reading the documentation. It will be fun and amazing for you.

Implementation of GUI Application for Calendar Project With Python Using Tkinter

In Python, we can make GUIs using Tkinter. If you are very imaginative and creative, you can do some amazing stuff with Tkinter. Here, we will make a Python Calendar GUI application using Tkinter. In this app, the user has to enter the year for which he wants to view the calendar, and then the calendar will appear.

Install Tkinter first using this command: pip install tk

We would also need a Calendar package, but we don’t have to install it. It is a default package that automatically comes with python.

Program:

#import calendar module
import calendar
#import tkinter module
from tkinter import *
#This function displays calendar for a given year
def showCalender():
    gui = Tk()
    gui.config(background='grey')
    gui.title("Calender for the year")
    gui.geometry("550x600")
    year = int(year_field.get())
    gui_content= calendar.calendar(year)
    calYear = Label(gui, text= gui_content, font= "Consolas 10 bold")
    calYear.grid(row=5, column=1,padx=20)
    gui.mainloop()

Explanation

ShowCalender function displays the calendar. Here, you can manage how the calendar is displayed when you enter a year in the search box and press enter. You can set the background color, which is grey here and can be changed in the code as per your choice. You can also set the dimension of the calendar, which is 550×600 here. Then you can ask for the input year in integer form. Once the user enters the year, calendar content is fetched from the calendar module of python by passing the year as an argument.

#Driver code
if __name__=='__main__':
    new = Tk()
    new.config(background='grey')
    new.title("Calender")
    new.geometry("250x140")
    cal = Label(new, text="Calender",bg='grey',font=("times", 28, "bold"))
    #Label for enter year
    year = Label(new, text="Enter year", bg='dark grey')
    #text box for year input
    year_field=Entry(new)
    button = Button(new, text='Show Calender',fg='Black',bg='Blue',command=showCalender)
    #adjusting widgets in position
    cal.grid(row=1, column=1)
    year.grid(row=2, column=1)
    year_field.grid(row=3, column=1)
    button.grid(row=4, column=1)
    Exit.grid(row=6, column=1)
    new.mainloop()

Explanation

In the driver code, firstly, we are giving background color to the left part of the screen(as shown in the image below).  Since it is a small window to give input year, we set its dimension as 250×140. In the button line below year_field, we call showCalendar function that we made above. This function shows us the full calendar for an input year.

Now, we need to adjust the widgets in the calendar also, and for that, we define the location in the grid for everything. You can play by changing grid row and column parameters to explore more.

Output:

calendar | Python projects

Implementation of Convert Image to a Pencil Sketch Project Using Python

This is going to be an interesting yet one of the best python projects. We will be writing the code step by step with the explanation.

We will use the OpenCV library for this project. Install it using the pip install opencv-python command.

Do follow the below steps and source code.

Step 1: Find an image you want to convert to a pencil sketch.

We are going to use a dog image. You can choose whatever you want.

Step 2: Read the image in RBG format and then convert it to a grayscale image. Now, the image is turned into a classic black-and-white photo. You can refer to the following syntax

import cv2
#reading image
image = cv2.imread("dog.jpg")
#converting BGR image to grayscale gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

Step 3: Invert the grayscale image, also called the negative image; this will be our inverted grayscale image. Inversion is basically used to enhance details.

#image inversion
inverted_image = 255 - gray_image

Step 4: Finally, create the pencil sketch by mixing the grayscale image with the inverted blurry image. This is done by dividing the grayscale image by the inverted blurry image.

blurred = cv2.GaussianBlur(inverted_image, (21, 21), 0)
inverted_blurred = 255 - blurred
pencil_sketch = cv2.divide(gray_image, inverted_blurred, scale=256.0)

We now got our pencil_sketch. So, display it using OpenCV.

cv2.imshow("Original Image", image)
cv2.imshow("Pencil Sketch of Dog", pencil_sketch)
cv2.waitKey(0)

Output:

Dog images | Python projects

See how beautiful it is. So, just try this with other images also and play with python. These are just the 3 projects we discussed. You can try more projects which will make you interested in programming. So, here is the list of a few projects.

Top 22 Beginner-Level Python Projects to Try Out

  1. Weight converter with GUI using Tkinter
  2. Send custom emails with Python
  3. Unique password generator GUI
  4. Random password generator
  5. Scraping data from Twitter
  6. Rock paper scissors Python game
  7. Alarm clock with GUI
  8. Youtube video downloader
  9. Tic-tac-toe with python programming language
  10. Python Snake game
  11. Hangman with python
  12. Currency converter with python
  13. Music player with python
  14. Dice rolling simulator
  15. Desktop notifications app
  16. Site connectivity checker
  17. Mad Libs generator
  18. Web scraping and extracting data by using APIs.
  19. Python command-line application
  20. Countdown clock and timer
  21. Number-guessing game
  22. Binary search algorithm

Top 6 Beginner to Advanced-Level Python Projects

Language translator using Google API in Python

Speech recognition in Python using Google Speech API

Create a simple assistant using Wolfram Alpha API

Chatbot with natural language processing(NLP)

Bubble sort visualizer using PyGame

Build simple automation apps

Conclusion

Today, we’re experiencing an ever-growing adoption of Artificial Intelligence, Machine Learning, and Data Science across most business sectors. One of the main things these fields have in common is the use of the Python programming language and python libraries like numpy and pandas in one way or another, so it’s important to learn python until the intermediate level. This we can achieve by continous practice. The projects listed in this article are fun ways of learning Python coding, and you must try them.

Key Takeways

  • Besides web development, Python is also used for data analytics, machine learning, and design. It is a popular and versatile programming language.
  • Praciticing on real tools and technologies makes you more confident about your strengths and helps identify and work on your weaknesses.
  • The more you experiment with different python projects, the more knowledge you gain.

Frequently Asked Questions

Q1. What is the best Python project for beginners?

A. A tic-tac-toe game is one of the best projects for beginners. This project can be built with the Pygame library. Pygame comes with all of the sound and graphic components you will need.

Q2. What is the best thing to do as a beginner in Python?

A. You can create projects to help you polish your python skills, and practicing can help you become a django python developer/web developer.

Q3. What are some Python projects for beginners with source code?

A. This is one of the interesting python projects and will generate a random number for each dice the program runs, and the users can use the dice repeatedly for as long as he wants. When the user rolls the dice, the program will generate a random number between 1 and 6 and display it to the user. It will also ask for user input if they want to roll the dice again.

About the Author

Gaurav Sharma

Love Programming, Blog writing and Poetry

Our Top Authors

Download Analytics Vidhya App for the Latest blog/Article

2 thoughts on "Top 31 Python Projects | Beginner to Advanced (Updated 2023)"

latestmodapks
latestmodapks says: August 30, 2022 at 2:30 pm
This is a great blog post for beginners! I'm a beginner in Python and this post has helped me a lot. Reply
ForHave
ForHave says: December 16, 2022 at 6:14 am
This is a great blog post for beginners! I'm a beginner in Python and this post has helped me a lot. Reply

Leave a Reply Your email address will not be published. Required fields are marked *