Search justacoding.blog. [Enter] to search. Click anywhere to close.

July 10th, 2022

10 Python Project Ideas For Beginners

If you’re new to programming, Python is a great first language to pick up. It’s relatively easy to learn and quite accessible, yet still extremely powerful and viable in a commercial sense. It’s also great for the hobbyist.

However, perhaps you are struggling to think of interesting app or project ideas to build with Python?

Worry not! We’ve compiled a list of 10 Python project ideas for beginners to sink their teeth into. The app ideas are all CLI-based (command line interface) to keep things nice and simple, this means there’ll be no GUI (graphical user interface) to worry about.

1. A password generator

Creating a password generator in Python is fairly straightforward.

In essence, your app needs to output a random string that’s (optionally) configurable via various input parameters.

Here’s how your Python password generator should work:

  • The user is prompted to provide a desired password length
  • The user is promoted to decide if the password should contain special characters or not
  • A randomly generated password is returned based on these inputs

So it’s fairly simple, there are some basic inputs and then the password generation logic would take place with these variables in mind.

> How many characters in length should your password be?
16

> Should it contain special characters (eg. * or &) (yes/no)
yes

> 3~:'<44!:`;/!32'

Here are some tips to help with this simple CLI-based app:

  • Store the available characters (ie. the alphanumeric ones) as a list. This means you can then easily use random.choice to select a character each time you need one
  • Store the special characters as a separate list. If the user wants to include the special characters in their password generation – merge the lists before password generation takes place
  • Have a loop that iterates x times, where x is the required password length as indicated by the user’s prior input
  • A character should be randomly selected for each iteration and stored in a new list
  • The resultant list can be converted to a string using join, which ultimately forms the final password generated by the app

Not only is the Python password generator fairly straightforward to create – it’s highly configurable and genuinely useful. This makes it a great project idea for aspiring Python developers to start with.

In terms of related Python command line interface projects — what about a password verification app? So a simple script, like above, but instead verify the strength of a password based on parameters like length, complexity and so on.

2. A weather app

Okay, so “weather app” is a bit of an exaggeration here. This simple Python project idea will simply allow the user to request weather information via the CLI.

(Edit: check out our Python weather app guide!)

  • The user enters their city, post code or other identifier as to their current whereabouts
  • The weather forecast is returned based on this input

The key to implementing this kind of functionality hinges on utilizing an API. One such suitable API would be the OpenWeather API.

The steps you will need to take to complete this basic Python application would be:

  • Prompt the user to supply their location
  • Make a web request to the OpenWeather (or similar) API – providing this supplied location as part of the request
  • Parse the response and return the required data back to the user in whatever structure you prefer
> Please enter your location (eg. your city or your post code):
Nottingham, England

> Today will be sunny, 14c
> Tomorrow will be cloudy, 11c

This is a great beginner Python CLI project to implement as it’ll allow you to familiarize yourself with web requests.

You’ll be making a GET request to the relevant API and then you’ll need to handle the response accordingly. Making web requests is a fundamental skill utilized in many different types of projects, Python or otherwise, so it’s certainly a good thing to have this knowledge under your belt.

Once you’re acquainted with working with APIs, this will open many doors for you with regards to other potential Python projects you can tackle — we’ve listed some of those further down in this list!

3. A guessing game – higher or lower

Play a simple game via the Python CLI.

  • The user is provided a random number
  • They are prompted to guess higher (h) or lower (l)
  • The result of their guess is revealed, ie. were they successful or not
  • The user must try to string together as many correct guesses as possible to formulate a total, the game ends once the user guesses incorrectly

The functionality required to implement this beginner Python project idea is fairly standard:

  • Prompt for user input, react to it accordingly
  • Generate random numbers and compare the user input with some simple logic
  • Keep track of the total score ie. how many correct guesses has the user made?
> The starting number is 10. Do you guess higher or lower? (h/l)
h

> Correct!
> The next number is 14. Do you guess higher or lower? (h/l)
l

> Incorrect! Game over. You provided 1 correct guesses out of 2

It’s worth considering the overall valid range that your application will implement.

For instance, the total range could be from 1-20, and the initial number could be a 10.

There are some edge-cases that should also be considered. For instance, when generating a random number, you must ensure that you don’t select either the first or last number, as this will effectively render the user’s guess redundant.

It would also be preferable to not return the same random number twice in quick succession.

4. A timezone converter

Knowledge of timezones and how to work with them is definitely something that’s very useful for any developer to have, whether you are working with Python or otherwise. Applications that serve users spanning multiple timezones must handle timezone conversion somehow to keep things consistent for the end user.

This simple utility script would work as follows:

  • Prompt the user to supply a datetime in a specific format, as well as the initial timezone
  • Prompt the user to supply a list of one or more timezones
  • Output the provided datetime converted to the supplied timezones
> Please supply your datetime:
10th October 2022, 09:00

> And your current timezone:
GMT

> Now supply a comma-separated list of timezones to convert this datetime to:
EDT, PST

> EDT: 10th October 2022, 05:00
> PST: 10th October 2022, 02:00

In terms of implementing this functionality, it would be best to start by looking over Python’s datetime documentation.

It’s a commonly used library that you can use to manipulating dates as well as times.

In particular, the astimezone method may prove to be useful in implementing this timezone conversion logic.

5. An interactive diary/journal that persists entries

The idea here is to prompt the user for a diary (or journal) entry, then save this entry to the filesystem in an organized and structured manner.

Much like the other project ideas listed in this article, the functionality will all take place via Python’s command line interface. And it’ll work as follows:

  • Prompt the user for their entry for the current day
  • Optionally, allow the user to supply an entry for a different day
  • Write the entry to a file, identified by the given day ie. 10_07_2022.txt
  • Store this file in a directory like mydiary/ or something similar

Subsequent entries should be stored in a similar fashion.

> Please provide the date (leave empty to default to today):
10/11/2022

> Now provide your entry:
It was a great day, I learnt some Python!

> All done, your entry has been saved (mydiary/10_11_2022.txt)

It should also be possible to list entries from a given range. Or show the last 10 entries via the CLI.

Likewise, deleting entries and modifies would also be useful functionalities to have.

This one is a great Python beginner project idea as it’ll teach you how to work with Python’s filesystem functionality, this is no doubt a handy skill to have under your belt moving forward!

6. A unit converter

A simple utility app for converting weights, distances, currencies and so on using the Python CLI.

Much like with some of the other beginner Python project ideas in this article, this app revolves around receiving user inputs and formulating the response accordingly, after executing some basic logic.

(Edit: check out our Python currency converter code example.)

> What would you like to convert?
weight

> From:
lbs

> To:
kg

> Please enter the weight:
100

> 100 lbs is equal to 45.3592 kgs

For things like weight and distance, it may be fine to hardcode values for conversion and forego an API request.

For currency, however, it would likely be best to involve and external API from which to retrieve the relevant conversion data. The fixer.io API is a good place to start in this regard.

Some things to consider when accepting the inputs:

  • You’ll need “valid” options for each type of unit. So weight conversions may accept lbs, kgs, stones and ounces for example.
  • You’ll need to accept only positive numeric values greater than zero

It would also be best to supply the user with these valid inputs somewhere in the CLI output before initial conversion.

7. A duplicate file remover

The idea behind this utility would be to remove duplicate files from a given directory. Again, you’ll need to use Python to work with the filesystem in question.

  • The user would indicate the target directory and then run the script
  • Duplicate files would firstly be detected and presented back to the user
  • At this point, the user can opt to automatically delete these files or not

In it’s most simplistic form, a duplicate file would be based on this kind of pattern:

myfile.txt
myfile (2).txt
myfile (3).txt

So myfile (2).txt and myfile (3).txt are determined to be duplicate versions of the original file (myfile.txt).

Of course, just because files are named as per this structure – this doesn’t make them “true” duplicates.

A more advanced (and less dangerous!) version of this script would verify file contents (as well as, or even independent of) filename.

In terms of actually removing files, you can take a look at os.remove in the official Python documentation and go from there.

8. A comma-delimiter

Let’s say you want to parse a list of inputs or other data into a string of comma-separated values, like you’d do using a tool such as delim.co.

This is a really handy utility that’s fun to recreate with a beginner Python app.

  • Supply a text file containing the inputs, or alternatively, paste the inputs directly into the CLI
  • Break down this data by separator – where separator would typically be the new line element (but can be configurable via the app)
  • Receive the CSV output directly in the CLI, or write it to a text file instead

This is a decent Python beginner project as it’ll get you familiar with several really important aspects:

  • Reading/writing to files in the filesystem
  • Parsing and restructuring data and formatting strings
> Please indicate the target file:
mydata.txt

> What separator would you like to use?
newline

> File to write to:
mycsv.csv

> Complete, there were no issues. mycsv.csv has been created.

In terms of actually implementing this functionality, you can either take a look at Python’s CSV library or you can opt for a more manual approach.

9. A dictionary/thesaurus

Here’s another Python app idea that relies on an external API.

  • The user is asked if they’d like to consult the dictionary (d) or the thesaurus (t)
  • The user types in the target word
  • The result is returned to them accordingly

So, as outlined in some of the previous Python beginner project ideas – the use of an API is a requirement here.

Make the relevant GET request to this API. Parse the response and display it back to the user as required.

> Would you like to use the dictionary or the thesaurus? (d/t)
d

> Please enter your target word:
reptile

> noun, any cold-blooded vertebrate of the class Reptilia, comprising the turtles, snakes, lizards, crocodilians, amphisbaenians, tuatara, and various extinct members including the dinosaurs.

It would also be sensible to handle invalid inputs. For example, if the user enters a numeric value, or an empty string.

Even in simple projects such as this one, it’s always best to consider these kind of things (edge cases, error handling — basically anything that sits outside of the “main” functionality of the app). This line of thinking will no doubt help when working working in more involved, intricate projects.

In terms of an API you can use for this purpose — take a look at the Merriam-Webster Dictionary API.

10. An anagram guessing game

A simple Python game. Rearrange the jumbled letters to form a valid word.

  • Fetch a random word either from an API or a predefined dictionary of words
  • Jumble it up entirely, so it’s mostly unrecognizable
  • Allow the user to guess at the word

To make this simple Python game idea more interesting – you could start simple (ie. fewer letters) and slowly work towards more advanced anagrams that are harder to figure out (ie. more letters).

> Hi, welcome to the anagram game. Would you like an easy, medium or hard anagram? (e/m/h)
m

> Okay, here it is: lubamrel
umbrella

> Correct!

Optionally, the user could be prompted with regards to how hard they’d like their anagram to be. They could supply “easy”, “medium” or “hard” – or even a numeric value which would return a word of specific length.

In terms of beginner Python CLI project ideas, this is amongst the most simple. Not only that, it’ll give you a good primer with regards to working with strings, that makes it an ideal candidate to implement for yourself.

Hints and tips to consider when building these beginner Python project ideas

No matter the complexity of the project, it’s always best to take a measured approach and firstly plan out how your implementation will work, at least in a basic sense.

Here are some tips and things to consider for these particular Python app ideas.

Implement user input first

It’s likely better to handle the user input before you look at introducing the core logic of the particular Python project idea in question.

For instance, with the unit converter, it may be better to prompt the user and validate all of their inputs before implementing any of the actual conversion logic.

Breaking down the app into basic building blocks like this is often a good way to work, arguably more so than a simple top-to-bottom approach, but it’s worth experimenting with what works best for you!

Try to break your app

Once you have a working implementation, try to think outside of the box.

The happy path is fine – so the app can be used in it’s intended manner and it general seems to work. But what if you provide some weird input? For instance a letter instead of a numeric value when converting weight.

Or a numeric value instead of a string when attempting to use the thesaurus.

Are the scenarios handle gracefully? Or does the app fall over?

A lot of problems (or bugs) that occur in software development in general revolve around edge-cases or unexpected inputs that weren’t necessarily considered to begin with.

Even with these simplistic beginner Python projects, you’ll find that it’s still possible to introduce bugs if you aren’t thorough enough during development/testing!

Consult the official Python documentation

This one is a no-brainer. Working with the documentation of your chosen language is a fundamental aspect of learning any new language.

If you’re stuck with regards to how to implement any of these beginner Python project ideas (ie. timezone conversion), there’s a good chance that browsing the Python datetime library docs would provide some useful insight here.

It may be the case that you don’t know what libraries or methods you need to use, simply browsing the relevant section of documentation will usually work wonders in this regard.

In closing

We hope you’ve enjoyed reading this list of beginner Python project ideas!

Check back later, we’ll be attaching code examples to each (or all) of the project ideas. We’ll also be taking a look at more advanced Python apps for you to look at implementing.

Thanks for reading!

Have any questions? Ping me over at @justacodingblog
← Back to blog