What Projects Can I do with Python?

Python Projects for Intermediates

Python projects are essential for learning Python as they provide experience and a platform to apply theoretical knowledge in practical scenarios. While attending courses or watching tutorials can provide a foundation, working on real projects and challenges is crucial for developing programming skills.

Practice projects offer several benefits. Firstly, they help learners gain practical knowledge by working on real-world problems. This practical experience allows individuals to understand how Python is used in various industries and domains. Additionally, Python challenges enhance problem-solving abilities as learners encounter and overcome challenges during the development process.

When you engage in projects, you gain a deeper understanding of Python concepts. You get to explore different aspects of Python development, experiment with techniques, and discover efficient solutions. This process enhances creativity and builds confidence in their programming skills.

Moreover, Python coding problems foster critical thinking skills. Learners are exposed to situations where they must analyze, plan, and implement solutions. They also learn to troubleshoot errors and debug their code, which is a crucial aspect of programming.

I addition to Practity’s real-world Python projects, here there is  selection of cool Python project ideas to keep practicing:

Art Auction Application

In this Python project, you will create an art auction system that allow users to set up new auctions, bid on art works and view the status of ongoing auctions. It will provide a real-world scenario for learners to apply their Python programming skills and build a functional application.

Steps to complete the challenge:

  1. Define the Auction class: Create a class called "Auction" that represents an individual auction. It should have attributes such as item name, starting price, current highest bid, and the user who placed the highest bid.
  2. Implement user input and menu options: Use the "input()" function to prompt the user for menu options such as creating an auction, bidding on an item, or viewing ongoing auctions. Based on the user’s input, call the appropriate methods or functions. You can also develop a user interface with Tkinter or Flask.
  3. Create an Auction management system: Implement methods or functions to handle creating new auctions, updating bids, and displaying the current status of ongoing auctions. Use data structures like lists or dictionaries to store and manage the auction data.
  4. Handle user interaction: Implement error handling to handle invalid user input, such as entering non-numeric bid values or selecting an incorrect menu option. Display appropriate messages to guide the user and provide feedback on the success or failure of their actions.
  5. Test the application: Create test cases to ensure the functionality of different components of the Online Auction System. Verify that auctions can be created, bids can be placed, and the system accurately tracks the highest bids.
  6. Enhance the system (optional): Once the basic functionality is implemented, you can consider adding additional features to make the system more robust. This could include features like automatic auction closing, notifications for winning bids, or implementing user authentication.

Simulate a Login Page

The aim of this Python challenge is  to build a regular login page using the Flask library. The page will allow users to sign up or log in with their username. It will provide a user-friendly interface and handle the authentication process securely.

How the page works?

  1. Sign Up: Users can create a new account by entering their desired username. The system will store the username securely for future logins.
  2. Login: Users can log in by entering their username. The system will verify if the username exists and grant access to the user’s account.

Functionalities to develop:

  1. Sign up: Implement a form where users can enter their desired username. Store the username securely for future logins.
  2. Login: Implement a form where users can enter their username. Verify if the username exists and grant access to the user’s account.
  3. Error handling: Display appropriate error messages if the user enters an invalid username or encounters any other issues during the sign-up or login process.

Steps to Complete the Challenge:

  1. Set up Flask: Install Flask using pip and import the necessary modules.
  2. Create routes: Define routes for the home page, sign-up page, and login page.
  3. Design templates: Create HTML templates for each page, including forms for sign-up and login.
  4. Create form handlers: Implement form handlers for sign-up and login to process user input.
  5. Store usernames: Store the usernames securely, either using a database or a file system.
  6. Implement authentication: Verify if the entered username exists and grant access to the user’s account.
  7. Error handling: Implement error handling to display appropriate messages for invalid inputs or other issues.
  8. Test the application: Run the Flask application and test the sign-up and login functionalities.

Online Test Exam

Create a command line program in Python to simulate an online history test exam. The exam is made up of 10 questions. The program will show one question at a time and each question will appear with three possible answers, where only one is correct.
If the student selects the right answer, he gets 1 point, if he chooses the wrong answer he losses 0.5 points and if he does not select any answer he gets no points.
After the last question, the program will display the final mark, where 10 is the maximum and 0 the minimum.

Steps:

  1. Define a list of 10 questions along with their corresponding answer options and correct answers.
  2. Import the necessary modules, such as random and time.
  3. Create a function to display each question along with the answer options.
  4. Initialize variables to keep track of the score and the list of questions.
  5. Randomly select 10 questions from the list of questions and present them one by one to the user.
  6. For each question, call the function to display the question and answer options, then prompt the user for their answer and check its correctness.
  7. Update the score based on the correctness of the answer.
  8. After answering all the questions, calculate the final grade based on the score.
  9. Display the final grade to the user.
  10. Optionally, provide feedback on each question’s correctness after the user answers them.
  11. Run the main program by calling the necessary functions in the correct order.

You can also make this Python challenge more real, and create a graphical user interface with the Tkinter or PyQT libraries.

Python Program to automate PDFs

Imagine you work in a major lawyer firm and you receive hundreds of PDFs every day. But you only need the information contain in the even pages. Create a Python program that reads all PDFs of your downloads folder, extract the information of even pages and save it in a csv file.

Steps

  1. Import the necessary libraries: OS, PyPDF2, and Pandas to work with files, PDFs, and CSV files, respectively.
  2. Define a function to extract information from even pages: Create a function that takes a PDF file’s path as input and extracts information from the even pages. Use the "PyPDF2" library to read the PDF and extract the desired information.
  3. Iterate through the PDFs in the downloads folder: Iterate through all the PDF files present in the downloads folder. Use the “OS” library to list the files and filter out only the PDF files.
  4. Call the function to extract information for each PDF: For each PDF file, call the function defined in step 2 to extract the information from the even pages.
  5. Save the extracted information in a CSV file: Create a CSV file and save the extracted information in it. You can use the Pandas library to write the data to a CSV file.
  6. Test the program: Test the program by running it and checking if the PDFs in the downloads folder are successfully processed, and the extracted information is saved in the CSV file.

Number guessing game project

The number guessing game project is a fun and interactive way to apply your Python skills. In this project, the computer generates a random number, and the player has to guess the correct number within a certain range. This project allows you to practice concepts such as random number generation, conditional statements, and loops. To start, import the necessary modules and define the range of numbers for the game. Generate a random number within this range and prompt the player to guess. Implement logic to check if the guessed number matches the random number and provide appropriate feedback. Continue this process until the player guesses the correct number. With this project, you not only enhance your Python skills but also create an entertaining game for others to enjoy.

Automate Emails to family and friends

Another Python challenge to automate tasks. Create a Python program that the first day of the quarter (1st January, 1st April, etc) automatically sends an email (using your gmail account) to a list of recipients (your family and friends) asking how they are doing.

Steps

  1. Import the necessary libraries: You will need the "smtplib" library to send emails using SMTP (Simple Mail Transfer Protocol) and the datetime library to get the current date.
  2. Set up your email provider: You need to have a valid email account with an email provider that supports SMTP access, such as Gmail. Make sure you enable “less secure apps” or generate an app-specific password if required.
  3. Define the email content: Create a string variable that contains the body of the email, asking recipients how they are doing and what is new. You can use formatting placeholders to personalize the email for each recipient.
  4. Define the recipients: Create a list or read a CSV file that contains the email addresses of the recipients.
  5. Write a function to send the email: Create a function that takes the sender’s email address, password, recipient’s email address, and the email content as parameters. Use the smtplib library to connect to the email provider’s SMTP server, authenticate, and send the email.
  6. Get the current date: Use the datetime library to get the current date.
  7. Check if it’s the first day of the quarter: Compare the current date with the first day of the quarter. If they match, proceed to send the email; otherwise, exit the program.
  8. Iterate over the recipient list: Use a loop to iterate over each recipient’s email address and call the function to send the email to each recipient.

Python Practice Program to organize images

This Python assignment is also focused on automation. Write a script that checks all images (JPG, PNG…) of your desktop folders, remove duplicated images, reduce the size of all of them to 200px and add a watermark. You will have to carry out the following tasks:

  1. Import necessary libraries: Import the required libraries, such as os, PIL, and hashlib.
  2. Define the image folder path: Set the path to the desktop folder where the images are located.
  3. Create a function to check image duplicates: Write a function that checks for duplicate images by calculating and comparing the hash values of the images. Use the hashlib library to generate hash values.
  4. Create a function to resize images: Define a function that resizes images to a specific size, such as 200px. Use the PIL library to open and resize the images.
  5. Create a function to add a watermark: Write a function that adds a watermark to the images. You can use the PIL library to open the images, add the watermark, and save the modified images.
  6. Iterate over the images: Use a loop to iterate over each image in the desktop folder. Check for duplicates, resize the images, and add the watermark using the defined functions.
  7. Test the program: Run the program and check if the images on the desktop are processed correctly, duplicates are removed, and the images are resized with a watermark.
  8. Handle errors and exceptions: Implement error handling to handle any potential issues, such as invalid image formats or file access errors.

Backup Program

A Python automation project for intermediate students: Develop a Python program that everyday copies all your files of the desktop folder, add them to a ZIP file and upload them to the cloud through the Google drive API.

  1. Set up the Google Drive API: Create a Google Cloud Platform project, enable the Google Drive API, and obtain the necessary credentials to use the API.
  2. Install the required libraries: Install the necessary Python libraries, including pydrive, which provides a wrapper for the Google Drive API.
  3. Authenticate the program: Implement authentication using the Google Drive API. This may involve generating access tokens or using service account credentials.
  4. Retrieve the files from the desktop folder: Write code to fetch all the files from the desktop folder. You can use the os module to access the desktop directory and retrieve the file names.
  5. Create a ZIP file: Use the zipfile module to create a new ZIP file. Iterate over the files retrieved in the previous step and add them to the ZIP file using the write method.
  6. Upload the ZIP file to Google Drive: Use the pydrive library to upload the ZIP file to Google Drive. Create a new instance of the GoogleDrive class, authenticate it using the credentials obtained in step 3, and upload the ZIP file using the UploadFile method.
  7. Schedule the program: Use a scheduling tool like cron (on Linux) or Task Scheduler (on Windows) to run the Python program daily. Set it up to execute the program at a specific time each day.
  8. Test the program: Run the program manually to ensure that it copies the files, creates the ZIP file, and uploads it to Google Drive successfully.

Age Calculator Desktop Application

A classic Python project to practice GUI. Create a desktop application with a blank space where users can enter a year and after pressing a button, it shows the age of that person.

  1. Import the tkinter library: Begin by importing the tkinter library in your Python script.
  2. Create a tkinter window: Use the "Tk()" function to create a window for your application.
  3. Create input widgets: Use the Entry widget to create an input field where users can enter their birth year.
  4. Create a button widget: Use the Button widget to create a button that triggers the age calculation when clicked.
  5. Define a function for age calculation: Create a function that calculates the age based on the year entered by the user and compared to the current year. Use the “datetime” library.
  6. Display the age: Use the Label widget to display the calculated age on the screen.
  7. Configure widget placements: Use the grid or pack method to arrange the widgets on the window.
  8. Run the tkinter event loop: Call the "mainloop()" method to run the tkinter event loop and display the application window.
  9. Test the application: Enter a birth year in the input field and click the button to see the calculated age displayed on the screen.

YouTube Videos downloader

A fun Python challenge to write a script that searches and downloads Youtube videos with the “pytube” library. The program will ask the user to enter a search term and it will download the top 5 videos found for that search term by number of views.

Steps:

  1. Install the pytube library: Use pip to install the pytube library by running the command pip install pytube in your command line.
  2. Import the necessary modules: In your Python script, import the pytube module to access its functionalities.
  3. Prompt the user for a search term: Use the "input()" function to prompt the user to enter a search term.
  4. Search for videos: Use the "pytube.YouTube()" function with the search term to search for videos on YouTube.
  5. Filter the search results: Sort the search results based on the number of views and select the top 5 videos.
  6. Download the videos: Use the "pytube.YouTube().streams.first().download()" method to download each of the top 5 videos.
  7. Display download progress: You can add a progress bar or display a message to show the progress of the downloads.
  8. Test the program: Run the script and enter a search term. Check if the top 5 videos are downloaded successfully.

Book a Flight with Python

Consider you are a frequent traveler and every month you take the same return flight to the same destination. Tired of this, develop a Python script with the Selenium library that navigates to an online travel agency, select a specific flight on a given date, fills in the personal data and books the flight.

Steps:

1) Install Selenium and set up the Python environment

2) Import necessary modules and libraries: webdriver, Keys, "WebDriverWait", etc.

3) Set up the web driver for the desired browser. Selenium supports multiple browsers like Chrome, Firefox, and Safari.

4) Navigate to the online travel agency website
Use the web driver to navigate to the online travel agency website: driver.get('https://www.exampletravelagency.com')

5) Select a specific flight on a given date: To select a specific flight, you need to interact with the elements on the web page using Selenium. Inspect the web page and identify the HTML elements corresponding to the flight selection. Then, use Selenium’s find_element method to locate and interact with those elements.

6) Fill in personal data: To fill in personal data, locate the relevant input fields on the web page and interact with them using Selenium.

7) Book the flight
After filling in the personal data, you can proceed to book the flight by interacting with the corresponding web elements.

8) Handle confirmation and verification
After booking the flight, you may encounter confirmation or verification steps. Use Selenium’s methods  to wait for specific elements to appear or change on the web page. Make sure to adjust the element locator (‘confirmation-message’) based on the actual HTML structure of the confirmation page:

# Wait until the confirmation message appears
confirmation_message = WebDriverWait(driver, 10).until(
    EC.visibility_of_element_located((By.ID, 'confirmation-message'))

9) Close the web driver: After completing the booking process, close the web driver to free up system resources.

Build a webscrapper

Web Scraping is a technique to extract data from web sites through an automated process. It is a form of copying data from the web and store it in a database or spreadsheet.
An interesting Python project idea is to write a script to extract data from the Wikipedia. You can also create
a more useful version, if the program downloads also the files you recently upload to a file sharing app.

We will be happy to hear your thoughts

Leave a reply

Python and Excel Projects for practice
Register New Account
Shopping cart