Academic Block

Beginner Python ProjectsGet Certified

What Makes a Good Beginner Project?

Reading about loops, functions, and dictionaries is useful, but real learning begins when you combine them to build something that works. A good beginner project is small enough to finish in an evening, uses only the tools that you already know, and gives a result that you can see and test right away. Building projects teaches skills that exercises cannot: breaking a problem into steps, choosing the right data structure, finding your own bugs, and deciding when a program is done. The ten examples in this lesson are complete mini projects, and each one practices a different group of skills from the earlier lessons.

  • Loops and formatting: print a neat temperature table and run a guessing game.
  • Lists and dictionaries: manage a to-do list, count words, and keep a grade book.
  • Strings and conditions: check how strong a password is.
  • Classes and errors: model a bank account that refuses to overdraw.
  • Functions and arithmetic: plan the cost of a road trip.
  • User input: split a restaurant bill and run a quiz in which the user types the answers.

Project 1: A Temperature Conversion Table

A temperature converter is a classic first project, because it needs only a formula, a loop, and some careful output formatting. In the United States, weather reports use degrees Fahrenheit, while most of the rest of the world and all of science use degrees Celsius, so a converter is genuinely useful. The project combines a function that does the calculation with a dictionary of data and a loop that prints one row for each city. Format specifications inside an f-string, such as :<12 and :>8.1f, line the columns up so that the table is easy to read.

Try It: Summer and Winter Highs

Click Test My Code. Add another city to the dictionary and check that it appears in the table.

What this code does: It defines a function that converts Fahrenheit to Celsius. It then prints a table with a header and one row for each of five cities, with the temperature in both scales, and finally it finds the hottest city with max().
def to_celsius(fahrenheit):
    return (fahrenheit - 32) * 5 / 9

cities = {"Phoenix": 104, "Miami": 88, "Chicago": 68, "Anchorage": 32, "Minneapolis": 14}

print(f"{'City':<12}{'F':>5}{'C':>8}")
for city, temp in cities.items():
    print(f"{city:<12}{temp:>5}{to_celsius(temp):>8.1f}")

hottest = max(cities, key=cities.get)
print("Hottest:", hottest)

Project 2: A Number Guessing Game

Games are a motivating way to practice loops and conditions, because the rules of a game are exactly the kind of “if this, then that” logic that programs are made of. In a guessing game, the player tries to find a secret number, and after every guess the program says whether the guess was too low, too high, or correct. The loop keeps going until the player wins, and break ends it early at the right moment. To keep the output the same every time, this version uses a fixed list of guesses instead of live typing, and a later example in this lesson shows how to read input from the player.

Try It: Playing with a Fixed List of Guesses

Click Test My Code. Change the secret to 30 and run it again to see a different path through the game.

What this code does: It stores a secret number and a list of five guesses. A loop goes through the guesses, counts the attempts, and prints whether each guess is too low, too high, or correct. When the secret is found, the program reports the number of tries and leaves the loop.
secret = 42
guesses = [50, 25, 37, 43, 42]
attempts = 0

for guess in guesses:
    attempts += 1
    if guess < secret:
        print(f"{guess} is too low")
    elif guess > secret:
        print(f"{guess} is too high")
    else:
        print(f"{guess} is correct! It took {attempts} tries")
        break

Project 3: A To-Do List Manager

A to-do list is a perfect project for learning how to use a list as a small database. You need to add items, remove items, and report what is left, and each of these jobs becomes a short function with a clear name. Splitting a program into functions is the most important habit in this lesson: a function with one job is easy to write, easy to test, and easy to reuse in a bigger program later. This project also shows a good way to handle an item that is not on the list, by checking with in before removing it, so that the program never crashes.

Try It: Weekend Chores

Click Test My Code. Add two tasks of your own and complete one of them.

What this code does: It keeps a list of tasks and defines one function that adds a task and another that completes a task. The program adds three tasks, completes one that exists, tries to complete one that does not exist, and prints how many tasks are left.
tasks = []

def add_task(task):
    tasks.append(task)
    print(f"Added: {task}")

def complete_task(task):
    if task in tasks:
        tasks.remove(task)
        print(f"Done: {task}")
    else:
        print(f"Not found: {task}")

add_task("Buy groceries")
add_task("Call Grandma")
add_task("Finish homework")
complete_task("Call Grandma")
complete_task("Wash the car")
print(f"{len(tasks)} tasks left: {tasks}")

Project 4: A Word Frequency Counter

Counting how often each word appears in a text is a small version of what search engines, spell checkers, and writing tools do with huge amounts of text. The natural tool for the job is a dictionary, in which every word is a key and its value is the number of times that the word has been seen. The method get(word, 0) returns the current count, or zero for a word that has not appeared yet, which avoids a separate check for a missing key. Sorting the dictionary items by their count then shows the most common words first.

Try It: Counting Words About Cities

Click Test My Code. Replace the sentence with a line from your own writing and see which word is the most common.

What this code does: It splits a sentence into words and counts them in a dictionary. It then sorts the pairs by their count, from the largest to the smallest, and prints the two most common words and the number of different words.
text = "new york and new orleans and new mexico are all fun"
counts = {}

for word in text.split():
    counts[word] = counts.get(word, 0) + 1

ranked = sorted(counts.items(), key=lambda pair: pair[1], reverse=True)
print(ranked[0])
print(ranked[1])
print(len(counts), "different words")

Project 5: A Password Strength Checker

A password checker is a great way to practice working with strings and with the built-in function any(), which tells whether at least one item of a sequence meets a condition. The program awards one point for each good property of a password: it is long enough, it contains a digit, it contains a capital letter, and it contains a special character. The total score is then used as a position in a list of ratings, which is a neat trick that replaces a long chain of if and elif statements. Real websites use rules like these, although serious security also depends on checking passwords against lists of leaked ones.

Try It: Rating Four Passwords

Click Test My Code. Add your own example password to the list, but do not use one of your real passwords.

What this code does: It defines a function that gives a password up to four points and returns a rating from Weak to Strong. A loop then rates four sample passwords and prints each one with its rating.
def check_password(password):
    score = 0
    if len(password) >= 8:
        score += 1
    if any(ch.isdigit() for ch in password):
        score += 1
    if any(ch.isupper() for ch in password):
        score += 1
    if any(ch in "!@#$%&*" for ch in password):
        score += 1
    return ["Weak", "Weak", "Fair", "Good", "Strong"][score]

for pw in ["cat", "sunshine1", "Sunshine1", "Sunshine1!"]:
    print(pw, "->", check_password(pw))

Project 6: A Bank Account with a Class

Classes let you bundle data and the actions that belong to it into one object, which makes them ideal for modeling things from the real world, such as a bank account. The account keeps its owner and its balance as attributes, and its methods deposit() and withdraw() are the only places where the balance changes. That is also the right place to enforce a rule: a withdrawal larger than the balance raises a ValueError, and the code that uses the account can catch it with try and except. This project combines classes, methods, exceptions, and formatted output in one small program.

Try It: Deposits and a Refused Withdrawal

Click Test My Code. Change the amount of the last withdrawal to 50 and see that no error occurs.

What this code does: It defines a BankAccount class with an owner, a balance, and two methods. It opens an account with 500 dollars, deposits 250, withdraws 100, and prints the balance. It then tries to withdraw 5000 dollars, which raises an error that the program catches and reports.
class BankAccount:
    def __init__(self, owner, balance=0):
        self.owner = owner
        self.balance = balance

    def deposit(self, amount):
        self.balance += amount

    def withdraw(self, amount):
        if amount > self.balance:
            raise ValueError("Insufficient funds")
        self.balance -= amount

account = BankAccount("Olivia Parker", 500)
account.deposit(250)
account.withdraw(100)
print(f"{account.owner}: ${account.balance:,.2f}")

try:
    account.withdraw(5000)
except ValueError as error:
    print("Error:", error)

Project 7: A Grade Book

A grade book shows how dictionaries and lists work together: each student is a key, and the value is a list of scores. For every student the program calculates the average with sum() and len(), and a small function converts the average into a letter grade. Keeping the grading rules inside one function means that you can change the cut-off scores in a single place if a teacher decides on a different scale. This is a very common pattern in real programs: store the data in a collection, loop over it, and let a function make the decisions.

Try It: Averages and Letter Grades

Click Test My Code. Change one of Ava’s scores to 95 and see how her letter grade changes.

What this code does: It stores three scores for each of three students in a dictionary. A function turns an average into a letter grade. The loop calculates the average of each student and prints it with one decimal place, followed by the letter in parentheses.
grades = {
    "Emma": [92, 88, 95],
    "Liam": [78, 85, 80],
    "Ava": [65, 70, 58],
}

def letter(average):
    if average >= 90:
        return "A"
    if average >= 80:
        return "B"
    if average >= 70:
        return "C"
    return "F"

for name, scores in grades.items():
    average = sum(scores) / len(scores)
    print(f"{name}: {average:.1f} ({letter(average)})")

Project 8: A Road Trip Budget Planner

A budget planner puts arithmetic to work on a question that people really ask: how much will this trip cost? The cost of the gas depends on the distance, the fuel economy of the car in miles per gallon, and the price of a gallon, and a small function can combine the three. Because the function takes only the distance as its parameter, the same formula can be applied to every destination in a loop and also inside a generator expression that adds up all the trips. Keeping the settings, such as the price of gas, in named variables at the top makes them easy to change when the numbers are different next summer.

  • Store settings such as mpg and gas_price in variables with clear names.
  • Put the formula into a function, so that it is written once and used many times.
  • Use sum() with a generator expression to add up the costs of all trips.
  • Format money with :,.2f for thousands separators and two decimals.

Try It: Trips from Kansas City

Click Test My Code. Change the price of gas to 4.20 and compare the new costs.

What this code does: It stores the distances from Kansas City to three cities, the fuel economy of a car, and the price of gas. A function calculates the cost of one trip. The loop prints the distance and the cost for each destination, and the last lines add up the cost of all three trips.
distances = {"Chicago": 500, "Denver": 600, "Nashville": 550}
mpg = 30
gas_price = 3.60

def trip_cost(miles):
    gallons = miles / mpg
    return gallons * gas_price

for city, miles in distances.items():
    cost = trip_cost(miles)
    print(f"{city}: {miles} miles, ${cost:,.2f}")

total = sum(trip_cost(m) for m in distances.values())
print(f"All three trips: ${total:,.2f}")
Tip: Start every project with the smallest version that works, such as one function that does one job, and test it before you add more. Choose clear names, put repeated code into functions, and run the program often, so that when something breaks, you know that the last few lines caused it. When you are stuck, print the values of your variables to see what the program is really doing.

Interactive Projects with User Input

Programs become much more fun when the user can take part, and the input() function is how a program asks a question and waits for the answer. Remember that input() always returns text, so a number has to be converted with int() or float() before it can be used in a calculation, and a text answer is best cleaned with strip() and lower() before it is compared. The two projects below follow this pattern: a bill splitter that converts three typed numbers, and a quiz that compares typed answers with the right ones. In both, the Program Input box supplies one line for every call of input().

Try It: A Restaurant Bill Splitter

The Program Input box is already filled with three lines: 84.50, 20, and 4. Click Run Code straight away, then try a different bill and tip.

What this code does: It asks for the amount of a restaurant bill, the tip percentage, and the number of people. A function calculates the tip, the total, and the share of each person. The program prints the three amounts as dollars with two decimals.
def split_bill(bill, tip_percent, people):
    tip = bill * tip_percent / 100
    total = bill + tip
    return tip, total, total / people

bill = float(input("Bill amount in dollars: "))
tip_percent = float(input("Tip percent: "))
people = int(input("Number of people: "))

tip, total, each = split_bill(bill, tip_percent, people)
print(f"Tip: ${tip:,.2f}")
print(f"Total: ${total:,.2f}")
print(f"Each person pays: ${each:,.2f}")

Try It: A State Capitals Quiz

The Program Input box is filled with austin and sacramento. Click Run Code, then replace the first answer with Dallas and see the other branch.

What this code does: It stores two quiz questions and their answers in a dictionary. For every question, it asks the user for an answer, cleans it with strip() and lower(), and compares it with the right answer. It prints a message for each reply and the final score.
quiz = {
    "Capital of Texas": "austin",
    "Capital of California": "sacramento",
}

score = 0
for question, answer in quiz.items():
    reply = input(question + "? ").strip().lower()
    if reply == answer:
        print("Correct!")
        score += 1
    else:
        print(f"Not quite, the answer is {answer.title()}")

print(f"Score: {score} out of {len(quiz)}")

Common Mistakes in Beginner Projects

Almost every beginner makes the same few mistakes when building a first project, and recognizing them early saves hours of frustration. Most of them have little to do with Python itself and a lot to do with how the work is planned: starting with too much, testing too late, and copying code without understanding it. Others are small technical slips, such as forgetting to convert the text that input() returns. The list below is worth reading before you start a new project and again whenever you feel stuck.

  • Starting too big: a project with ten features is rarely finished. Build the smallest version first, and add features one at a time.
  • Not planning the steps: write the steps in plain words or comments before you write code.
  • Testing too late: run the program after every few lines, so that a new error has only a few suspects.
  • Forgetting that input() returns text: convert with int() or float() before calculating.
  • Trusting the user to type correctly: a person may type letters where a number is expected. Use try and except for ValueError.
  • Writing one giant block: split the program into functions that each do one job, with a clear name.
  • Hard-coding values everywhere: put settings such as prices and limits into named variables at the top.
  • Copying code you do not understand: read it line by line and change a value to see what happens.

Key Takeaways

Building projects is where Python knowledge turns into Python skill, and even a very small program teaches you more about planning, testing, and debugging than a page of exercises. The ten projects of this lesson used loops, lists, dictionaries, strings, functions, classes, exceptions, and user input, which together cover most of the basics. The points below summarize the main lessons, and they prepare you for the next lesson, a data analysis project, in which you will use your skills on a larger, more realistic task. Remember them whenever you start a new idea.

  • A good beginner project is small, uses tools that you know, and gives a result that you can test right away.
  • Split the work into functions that each do one job, and give them clear names.
  • Use lists for ordered items, dictionaries for pairs such as names and scores, and classes for things with data and actions.
  • Format output with f-strings, such as :<12 for alignment and :,.2f for money.
  • Convert the text that input() returns, and clean text answers with strip() and lower().
  • Use try and except to handle errors, and raise to refuse impossible actions.
  • Start small, test often, print values when stuck, and add features one at a time.

Frequently Asked Questions

These are the questions that students ask most often when they start to build their first Python projects. The answers are brief and practical, and each idea appears in one of the examples above. If something is still unclear, pick one of the ten projects, change a rule or a number, and run it again, because modifying a working program is one of the best ways to learn how it works.

What are good beginner Python projects?

Good first projects are small programs with a clear result, such as a temperature converter, a number guessing game, a to-do list, a word counter, a password checker, a tip calculator, a grade book, or a quiz. They use basic tools like loops, lists, dictionaries, functions, and input, and each one can be finished in a short time.

How do I choose my first Python project?

Pick something that interests you and that you can describe in one sentence, such as a program that splits a restaurant bill. Make sure that the first version needs only what you already know. It is better to finish a tiny project than to abandon an ambitious one, and you can always add features later.

What should I do when my project does not work?

Read the error message from the bottom up, because the last line tells you the type of the problem and the line above it shows where it happened. Print the values of your variables to see what the program is really doing, and test small parts separately. Changing one thing at a time makes it easier to find the cause.

Do I need to install libraries for beginner projects?

No. All the projects in this lesson use only what comes with Python itself. The standard library has modules such as math, random, datetime, and json, which are enough for many first projects. Libraries such as pandas or matplotlib are useful later, when you work with data and charts.

Why should I put my code into functions?

A function gives a piece of code a name and a single job. It can be tested on its own, reused in several places, and changed in one place instead of many. Programs made of small functions are easier to read, and bugs are easier to find because each function is short.

How do I get numbers from the user in a project?

Use input() to read a line of text and convert it with int() for whole numbers or float() for decimals, for example price = float(input(“Price: “)). To handle mistakes, such as a user typing letters, wrap the conversion in try and except ValueError and ask again or show a friendly message.

How can I save the data of my project?

Write the data to a file with a with open() block, for example as text lines, or as JSON using the json module, and read it back the next time the program starts. This way, a to-do list or a grade book is still there after the program ends.

What should I build after beginner projects?

Move on to projects that use real data, such as analyzing a CSV file with pandas, drawing charts with matplotlib, or building a larger program that combines several of the small projects. The next lessons in this tutorial guide you through a data analysis project, a visualization project, and a final capstone project.

Ready for the next step?Put your skills to work by analyzing a real-style dataset step by step.
Next: Data Analysis Project →