# 9 Python Project Ideas (Begginer, Intermediate, Advanced)

Article updated on Sunday, November 26, 2023. Are you searching for your first Python project? Or wondering how to code small projects to improve fast? What can a beginner do in Python to level up?

Developing Python projects is the best way to improve your coding skills!

By working on several projects from this list, you’ll be able to:

• Showcase projects in your portfolio
• Create a simple game using the PyGame library
• Build user interfaces in Python

Let’s explore some examples of projects and exercises designed for Python beginners.

# Project Difficulty
1 The Right Price ★☆☆☆☆
2 Rock Paper Scissors ★★☆☆☆
3 Fibonacci Number Generator ★★☆☆☆
4 Binary Search Algorithm ★★★☆☆
5 Tic Tac Toe Game ★★★☆☆
6 Hangman Game ★★★☆☆
7 Python Bot ★★★★☆
8 Data Visualization with Python ★★★★☆
9 Image Creator ★★★★☆

## 1. The Price Is Right

This first project is a fun game known to all beginners. The program generates a random rounded price. The user’s goal is to guess the price. Each time the user guesses wrong, the computer tells them if it’s higher or lower than the given price. With each computer hint, the final score achievable by the player decreases.

The aim of The Right Price is to guess an integer randomly chosen by Python. Write a script that assigns a number to a variable. In a loop, prompt the user for an input and inform the player if the entered number is equal to, greater than, or less than the right price.

By creating this small script, you’ll learn to:

• capture keyboard inputs from a user
• create functions to validate that the entered number is an integer
• compare a reference variable (the price) with another variable
• calculate the difference between two numbers
``````import random

price = random.randint(1, 10)

score = 100
attempts = 0

print("Guess the right price! The price is a number between 1 and 10 inclusive.")

while True:
number = int(input())
attempts += 1
if number < price:
print("The right price is higher")
if number > price:
print("The right price is lower")
if number == price:
print(f"Congratulations, you found the right price {price} in {attempts} attempts, your score is {int(score / attempts)}!")
break

print("Game over")``````

## 2. Rock Paper Scissors

The program prompts the user to make the first move before making a move. Once the move is validated, the input is evaluated, and the entered input can be a string, letter, or number. After evaluating the string, the result function determines the winner, and the score counting function updates the total score.

To create the rock-paper-scissors game, implement the basic logic (rock beats scissors, paper beats rock, scissors beat paper) then prompt for a keyboard input. The computer chooses a random move with a function from the random package, and finally, display who won the game.

Creating a rock-paper-scissors game is a good exercise to practice Python and complete your first projects.

By coding a rock-paper-scissors game, you’ll learn to create:

• a function that generates randomness: rock, paper, or scissors
• a function to check and validate the played move
• a result function to declare the winner of the round
• a points counter to track the total score
``````import random

rounds = int(input("How many rounds do you want to play? "))

player_score = 0
computer_score = 0

options = ["rock", "paper", "scissors"]

while player_score < rounds and computer_score < rounds:
player_choice = input("What do you play? Type 'rock', 'paper', or 'scissors' ")

while player_choice not in options:
input("Invalid choice! Choose rock, paper, or scissors (without quotes)")

computer_choice = random.choice(options)

if player_choice == computer_choice:
print("Tie. Restart the script to play again")
elif (player_choice == "rock" and computer_choice == "scissors") \
or (player_choice == "paper" and computer_choice == "rock") \
or (player_choice == "scissors" and computer_choice == "paper"):
print("You win the round,", player_choice, "beats", computer_choice)
player_score += 1
else:
print("Computer wins the round,", computer_choice, "beats", player_choice)
computer_score += 1

if player_score == rounds:
print("You won the game!")
else:
print("Computer wins :(")``````

## 3. Fibonacci Number Generator

The mathematical series known as the Fibonacci sequence has been one of the most popular computer questions. Essentially, you start with two numbers, preferably 0 and 1, and add them to create your third Fibonacci number. Then, just add the sum and the penultimate Fibonacci term to generate the next one.

This results in:

``0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987...``

To create the Fibonacci sequence, ask the user for the position of the number, then generate the sequence up to that number. Once generated, you can display the corresponding number to the user. You can go further and show the user the entire series up to that point.

This is one of the best Python projects to get started with the concept of recursive function.

Here’s an example of a basic implementation of a Fibonacci number generator:

``````numbers = int(input("Enter the number of Fibonacci numbers to display: "))

a = 0
b = 1
total = 0

print("The first {0} numbers in the Fibonacci sequence are:".format(numbers), end=" ")
for _ in range(numbers):
print(total, end=" ")
a = b
b = total
total = a + b``````

Or recursively:

``````numbers = int(input("Enter the number of Fibonacci numbers to display: "))

def fibonacci_recursive(n):
if n <= 1:
return n
else:
return fibonacci_recursive(n - 2) + fibonacci_recursive(n - 1)

print("The first {0} numbers in the Fibonacci sequence are:".format(numbers), end=" ")

for i in range(numbers):
print(fibonacci_recursive(i), end=" ")``````

## 4. Binary Search Algorithm

To introduce you to algorithmic complexity, you can create a simple binary search algorithm.

You will use a sorted array and divide the array at each iteration. If the desired number is in the first part, you continue with the first half of the array and discard the second. Then, divide the first half in two and repeat the operation until you find the desired number.

``````def binary_search(x, array):
start = 0
end = len(array) - 1
mid = 0

while start <= end:

mid = (end + start) // 2

# Ignore the first part of the array
# If x is greater than the middle element of the array
if array[mid] < x:
start = mid + 1

# Ignore the second part of the array
# If x is less than the middle element of the array
elif array[mid] > x:
end = mid - 1

# Value x found in the array at position mid
else:
return mid

# If we're here, x is not in the array
return -1

array = [1, 1, 2, 3, 5, 8, 13, 21, 34]
x = 13

result = binary_search(x, array)

if result != -1:
print("x is present at position", str(result))
else:
print("x is not in the array")``````

## 5. Tic-Tac-Toe Game

Tic-Tac-Toe, also known as “noughts and crosses” or “oxo” in Belgium, is a very common and easy-to-play game. The game’s principle is simple. It’s a turn-based game where the goal is to align a trio of circles or crosses diagonally, horizontally, or vertically on a 3×3 grid to achieve victory.

The challenge in creating this game primarily involves getting acquainted with 2D array indexing and understanding how to check for alignments diagonally. Once these issues are resolved, coding should become simpler.

For further advancement, you can also have fun creating a graphical interface with PyGame or another Python graphical library.

Here’s an example of a basic implementation of the tic-tac-toe game:

``````board = [" " for _ in range(9)]  # creates a list of 9 space characters " "

def display_board(b, winner=None):
print(" " + b + " | " + b + " | " + b + " ")
print("---+---+---")
print(" " + b + " | " + b + " | " + b + " ")
print("---+---+---")
print(" " + b + " | " + b + " | " + b + " ")
if winner:
print("* Game over: Player {0} won. *".format(winner))

def tic_tac_toe():
player = "X"
turn = 0

while True:
display_board(board)
print("> Player's " + player + " turn. Enter a number from 1 to 9.")

move = int(input()) - 1  # our array is from 0 to 8, so we subtract 1

if board[move] == " ":
board[move] = player
turn += 1
else:
continue  # move to the next loop iteration without executing the code below

if board == board == board != " " \
or board == board == board != " " \
or board == board == board != " " \
or board == board == board != " " \
or board == board == board != " " \
or board == board == board != " " \
or board == board == board != " " \
or board == board == board != " ":
display_board(board, player)
break

if turn == 9:
print("It's a tie")
break

player = "O" if player == "X" else "X"  # switch player

if __name__ == "__main__":
tic_tac_toe()``````

## 6. Hangman Game

In the realm of entry-level Python projects, Hangman is one of the most popular games. A word is chosen either by the opposing player or the program. The player has the entire alphabet to guess the letters.

The goal for the player is to complete the word by choosing the correct letters. If the letter is correct, the word gets filled. If the chosen letter is incorrect, you lose a life, and the hangman figure appears further.

The game ends either in victory if the entire word is found or in defeat if the hangman figure appears completely (you run out of lives). Traditionally, six errors are allowed before the player loses the game, but this number can be modified depending on how you want to create your iteration of the game.

## 7. Developing a Bot in Python

To learn Python by doing simple projects, you can also delve into scripting and automation with bots. You can easily create a bot that performs very simple tasks in just a few dozen lines of code. For instance, I made a Discord Bot in Python using the `discord.py` library as a base for building a Discord bot in Python.

## 8. Data Visualization with Python

Python excels in the world of data science; it would be a shame not to explore this aspect offered by the programming language. So, I suggest visualizing data with the matplotlib library.

``````# Importing the module for data visualization
from matplotlib import pyplot as plt

# Values for the X-axis
x = [1, 2, 3, 4]

# Values for the Y-axis
y = [2, 4, 8, 16]

# Function to create the graph
plt.plot(x, y)

# Function to show the graph
plt.show()``````

💡 For this example, I’m using `jupyter` (formerly iPython), which allows you to write Python interactively in your browser. Jupyter is entirely free and enables learning Python with visual results directly. I recommend this package to all beginners. You can try Jupyter for free by following this notebook.

Play around with enhancing the display of this `plot`, import data, change the chart type (you can find examples on the matplotlib website).

## 9. Generating Images with Python and Pillow

Want to automate content creation for your Instagram, Pinterest, website, or personal project? Then Pillow will save you a ton of time.

As a final project idea in this list of Python projects for beginners, I suggest exploring the Pillow package that allows you to create images. With Pillow or Python Imaging Library (PIL), you can define an image size and place colors, text, and other images onto it.

For instance, to learn a foreign language, you can create a list with the word in French, the word in the language

you want to learn, and the associated image. Then, create your image with Pillow, add these 3 elements, and there you have flashcards to learn more vocabulary in a new language!

Interested in generating images with artificial intelligence? Check out my article on the best AI image generators. There are even solutions to automate image creation in Python.

## More Python Project Ideas

I hope I’ve inspired you to create one or more projects in Python.

By now, you should be able to :

• create small games with or without graphical interfaces
• use Python libraries
• and understand control structures and algorithmic complexity

As you’ve seen, Python is very versatile and allows you to delve into various domains of coding.

Article originally written in French on CommentCoder.com  Hey, I'm Thomas 👋 Here, you'll find articles about tech, and what I think about the world. I've been coding for 20+ years, built many projects including Startups. Check my About/Start here page to know more :).