Print the Fibonacci series, useful for teaching basics of looping.
Number Guessing Game
The user thinks of a number between 1 and 100. The computer tries to guess it based on feedback about whether the previous guess was too high or low. This one was great for learning about the kinds of off-by-one errors that one customarily runs into while implementing a binary search.
Print the non-negative binary integers in increasing order. This one forces some representation choices.
Recognizing “A man, a plan, a canal — Panama!” as a palindrome requires some string manipulation.
Door Code Recognizer
Our Paris apartment building will let you in if you enter the correct five-digit sequence regardless of how many incorrect digits you previously entered. I thought replicating this behavior in Python would be slightly tricky for the kid but he saw that a FIFO could easily be created from a list.
Monte Carlo Pi Estimator
If you generate random points in the square between -1,-1 and 1,1, the fraction of points that lie inside the unit circle will approach pi/4. The kid got a kick out of seeing this happen. Of course I had to explain the derivation of pi/4 and the formula for a circle since he hasn’t seen this stuff in school yet. Also of course we could have simply worked in quadrant one but that seemed to make the explanations more complicated.
I should perhaps add that I explained this exercise to my kid very differently than I’m explaining it here. We started by drawing a box containing a circle and then pretended to throw darts into the box. The concepts are not hard: all we need to understand is random sampling and the area of a circle. Math gets made to seem a lot harder than it is, in many cases, and also we tend to conflate the difficulty with the order in which the concepts are presented in the school system.
Turtle Graphics Interpreter
The current project is implementing a turtle that takes four commands:
- forward n
- right-turn n
- left-turn n
- color c
So far we’ve been restricting angles to 0, 90, 180, 270 (and no radians yet…) but I don’t think sine and cosine will be hard concepts to explain in this context. Also, so far the turtle commands are just a series of function calls, the parser will come later. I wonder what would be the simplest loop construct for this turtle language? Perhaps “repeat n” followed by some sort of block construct.
One of the most common, fun, and instructive types of coding exercises is manipulating strings. Coding with strings allows students to practice different methods, operations, and many other skills. The exercise above asks students to return the word aardvark if their chosen word starts with the letter ‘a’.
All successful coders use functions consistently. Functions allow programmers to write modular code that can be executed on demand and with a variety of different conditions. In this function exercise, students practice creating a simple function that takes numeric inputs.
Another key coding concept that all students should know is conditionals, also known as if/else statements. For this exercise, students will have to combine string methods and conditional flow statements to determine if a string has an even or odd number of letters.
Loops are useful for writing code that must repeat. They have a wide range of applications, and are one of the trickier core concepts of programming. Here, students practice using loops to write a simple search algorithm.
Discover fun Python questions for beginners
Next up, we have some good Python questions for beginners. These questions will push your student’s Python abilities a little more, and may require multiple Python concepts.
One of the biggest applications of coding is for solving math problems. In this exercise, students practice writing a function that calculates the area of a triangle using its base and height. As an extension, ask your students to create more functions that calculate the areas of different shapes – or even better, a single function that can be used to calculate the area of a specified shape.
While we learn how to count at an early age, counting problems can be one of the tougher challenges for a novice coder. In Arrays, students are asked to combine conditionals, loops, modular math, or other coding tools to count the number of even integers in an array.
For all our Star Wars fans out there, this next challenge presents a fun application of dictionaries. Dictionaries store information as key/value pairs, and can be used to link information. Students will create a dictionary that can be used to fill in the phrase, “Luke, I am your ________” given the person’s relationship to one of our favorite Star Wars heroes.
Try fun Python challenges
For students who are confident in their fundamentals and would like to push their skills, we recommend these Python challenges.
There are several ways to accomplish this challenge, which requires students to find the missing number in an array. This exercise presents a good opportunity for coders to develop multiple methods for solving the same problem.
At first, this challenge might seem simple – check to see if a string contains the word ‘cat’ and the word ‘dog’ the same number of times. There are some tricky tests that your code must pass, however, making this a worthy string challenge for your student.
In Big Difference, students must write code that takes an array and returns the difference between the largest and smallest numbers in the array. This challenge can require the use of many fundamental coding concepts, and requires students to think creatively about their approach.
Python Projects You Can Build
- Mad Libs
- Guess the Number Game (computer)
- Guess the Number Game (user)
- Rock, paper, scissors
- Countdown Timer
- Password Generator
- QR code encoder / decoder
- Tic-Tac-Toe AI
- Binary Search
- Sudoku Solver
- Photo manipulation in Python
- Markov Chain Text Composer
- Connect Four
- Online Multiplayer Game
- Web Scraping Program
- Bulk file renamer
- Weather Program
- Code a Discord Bot with Python – Host for Free in the Cloud
- Space invaders game
Mad libs Python Project
In this Kylie Ying tutorial, you will learn how to get input from the user, work with f-strings, and see your results printed to the console.
This is a great starter project to get comfortable doing string concatenation in Python.
Guess the Number Game Python Project (computer)
Guess the Number Game Python Project (user)
In this Kylie Ying tutorial, you will build a guessing game where the computer has to guess the correct number. You will work with Python’s random module, build functions, work with while loops and conditionals, and get user input.
Rock, paper, scissors Python Project
In this Kylie Ying tutorial, you will work with
random.choice(), if statements, and getting user input. This is a great project to help you build on the fundamentals like conditionals and functions.
Hangman Python Project
In this Kylie Ying tutorial, you will learn how to work with dictionaries, lists, and nested if statements. You will also learn how to work with the string and random Python modules.
Countdown Timer Python Project
In this Code With Tomi tutorial, you will learn how to build a countdown timer using the
time Python module. This is a great beginner project to get you used to working with while loops in Python.
Password Generator Python Project
In this Code With Tomi tutorial, you will learn how to build a random password generator. You will collect data from the user on the number of passwords and their lengths and output a collection of passwords with random characters.
This project will give you more practice working with
for loops and the
random Python module.
QR code encoder / decoder Python Project
In this Code With Tomi tutorial, you will learn how to create your own QR codes and encode/decode information from them. This project uses the
This is a great project for beginners to get comfortable working with and installing different Python modules.
Tic-Tac-Toe Python Project
In this Kylie Ying tutorial, you will learn how to build a tic-tac-toe game with various players in the command line. You will learn how to work with Python’s
math modules as well as get continual practice with nested if statements.
Tic-Tac-Toe AI Python Project
In this Kylie Ying tutorial, you will learn how to build a tic-tac-toe game where the computer never loses. This project utilizes the minimax algorithm which is a recursive algorithm used for decision making.
Binary Search Python Project
In this Kylie Ying tutorial, you will learn how to implement the divide and conquer algorithm called binary search. This is a common searching algorithm which comes up in job interviews, which is why it is important to know how to implement it in code.
Minesweeper Python Project
In this Kylie Ying tutorial, you will build the classic minesweeper game in the command line. This project focuses on recursion and classes.
Sudoku Solver Python Project
In this Kylie Ying tutorial, you will learn how to build a sudoku solver which utilizes the backtracking technique. Backtracking is a recursive technique that searches for every possible combination to help solve the problem.
Photo Manipulation in Python Project
In this Kylie Ying tutorial, you will learn how to create an image filter and change the contrast, brightness, and blur of images. Before starting the project, you will need to download the starter files.
Markov Chain Text Composer Python Project
In this Kylie Ying tutorial, you will learn about the Markov chain graph model and how it can be applied the relationship of song lyrics. This project is a great introduction into artificial intelligence in Python.
Pong Python Project
In this Christian Thompson tutorial, you will learn how to recreate the classic pong game in Python. You will be working with the
turtle Python modules which are great for creating graphics for games.
Snake Python Project
In this Tech with Tim tutorial, you will learn how to recreate the classic snake game in Python. This project uses Object-oriented programming and Pygame which is a popular Python module for creating games.
Connect Four Python Project
In this Keith Galli tutorial, you will learn how to build the classic connect four game. This project utilizes the
sys Python modules.
This project is great if you have already built some smaller beginner Python projects. But if you haven’t built any Python projects, then I would highly suggest starting with one of the earlier projects on the list and working your way up to this one.
Tetris Python Project
In this Tech with Tim tutorial, you will learn how to recreate the classic Tetris game. This project utilizes Pygame and is great for beginner developers to take their skills to the next level.
Online Multiplayer Game Python Project
In this Tech with Tim tutorial, you will learn how to build an online multiplayer game where you can play with anyone around the world. This project is a great introduction to working with sockets, networking, and Pygame.
Web Scraping Program Python Project
In this Code With Tomi tutorial, you will learn how to ask for user input for a GitHub user link and output the profile image link through web scraping. Web scraping is a technique that collects data from a web page.
Bulk File Re-namer Python Project
In this Code With Tomi tutorial, you will learn how to build a program that can go into any folder on your computer and rename all of the files based on the conditions set in your Python code.
Weather Program Python Project
In this Code With Tomi tutorial, you will learn how to build a program that collects user data on a specific location and outputs the weather details of that provided location. This is a great project to start learning how to get data from API’s.
Code a Discord Bot with Python – Host for Free in the Cloud
In this Beau Carnes tutorial, you will learn how to build your own bot that works in Discord which is a platform where people can come together and chat online. This project will teach you how to work with the Discord API and Replit IDE.
After this video was released, Replit changed how you can store your environments variables in your program. Please read through this tutorial on how to properly store environment variables in Replit.
Space Invaders Game Python Project
In this buildwithpython tutorial, you will learn how to build a space invaders game using Pygame. You will learn a lot of basics in game development like game loops, collision detection, key press events, and more.