Skip to content
Sign upLog in
← Back to Community

5 Fun beginner Python Projects 😃 [updated]

Profile icon

Five Beginner Python Projects [updated]

I decided to write this because I see a bunch of beginners asking what they should do, so here are five really simple and fun projects!

Note: I updated this code Feb 6, 2022. Depending how long this remains up the code might not run perfectly. I’m going to try and be better about updating the code every month or so. If there are errors just let me know and I’ll fix the code.

1. Adventure Story

I’m a writer. I haven’t been published yet but I have written several full length novels and probably 50+ Short Stories and Novella’s. All together I’ve easily written over a million words. Now I don’t want to brag about that, but it’s just to show that I really love stories! I also love coding. So text adventures are always super fun for me, especially if the story is great.
Now I’m not going to give you a lecture on a five act story structure and character development, but if you are interested in that I can. I’ll just focus on the programming Element.

Right then, the first thing we’ll need is any libraries we are going to use.

import os #very useful for clearing the screen or other os commands import random #generate random stuff

Now, we need some variables to hold some of the player data.

name = input("Name Please: ") #We’ll use this to get the name from the user nickname = input("Nickname: ")

Next, welcome them to the game.

print("Hello and welcome " + name)

Now for the story. The most important part of all stories is the introduction, so let’s print our introduction

print("Long ago, there was a magical meal known as Summuh and Spich Atip") #We can drop a line by making a new print statement, or we can use the escape code \n print("It was said that this meal had the power to save lives, restore peace, and stop evil\nBecuase it was so powerful, it was hidden away on a mountain that could not be climbed\nBut it’s power brought unwanted attention, and a great war broke out.\nFinally, the leaders of the good side chose a single hero to go and find the Summah and Spich Atip, that hero was " + name + "\n so " + nickname + " headed out to find this great power, and stop the war…")

Then we begin the story.
We start be giving the user a scenario and then a choice for them to make

print("After hiking through the wastelands for a long time, you come to a massive ravine, there is only a single way across\nA rickety old bridge, taking that could be very dangerous, but… maybe you could jump across?") choice = input("[1] Take the bridge [2] Try and jump over") #Now we check to see what the player chose

Note that input() will return a string. So despite the user inputing a number (1 or 2) the program will treat it as a string. So our if statement must check if the input is equal to a string value and not a number.

if choice == "1": # see how the number is in a string format print("You slowly walk across the bride, it creakes ominously, then suddenly breaks! You flail through the air before hitting the ground a thousand feet below. Judging by the fact that you hit the ground with the equivalent force of being hit by a cement truck moving at 125 miles an hour, you are dead…") #The player lost, so now we’ll boot them out of the program with the exit command exit() #Then we check to see if they made the other choice, we can do with with else if, written as elif elif choice == "2": print("You make the jump! You see a feather hit the bridge, the weight breakes it and sends it to the bottom of the ravine\nGood thing you didn’t use that bridge.") #Now we can continue the story print("A few more hours of travel and you come to the unclimbable mountain") choice == input("[1] Give up [2] Try and climb the mountain") if choice == "1": print("You gave up and lost…") #now we exit them again exit() elif choice == "2": print("you continue up the mountain. Climbing is hard, but finally you reach the top.\nTo your surprise there is a man standing at the top of the mountain, he is very old.") print("Old Man: Hey " + nickname) print("You: How do you know my name!?!") print("Old Man: Because you have a name tag on…") print("You: Oh, well, were is the Summuh and Spich Atip?") print("Old Man: Summuh and Spich Atip? You must mean the Pita Chips and Hummus") print("You: Pita…chips…humus, what power do those have?") print("Old Man: Pretty simple kid, their organic…") input("Press enter to continue") #Now let’s clear the screen os.system("clear") print("YOU WON!!!")

There you have it, a pretty simple choose your own ending story. You can make it as complex or uncomplex as you like.


Ever make secret messages as a kid? I used to all the time. Anyways, here’s the way you can make a program to encode messages! It’s pretty simple. First things first, let’s get the message the user wants to encode, we’ll use input() for that:

message = input("Message you would like encoded: ")

Next we’ll split that string into a list (array in other languages) of characters.

values = [letter for letter in message]

We also need two lists. One a plain alphabet, and another that is scrambled which will be the secret alphabet. Don’t forget to include the “ “ (space) character!

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' '] secret_alphabet = ['u', 'o', 'i', 'x', 'a', 'k', 'g', 'j', 'c', 'w', 'e', 'f', 'l', 'y', 'n', 'h', 's', 'm', 'z', 'p', 'v', 'b', 'd', 'r', 't', 'q', ' ']

Then two functions. One for encoding our string and one for decoding it.

We’ll start with the encoding part:

def encode(values): output = "" for letter in values: index = alphabet.index(letter) output += secret_alphabet[index] return ouput

And Decode

def decode(values): output = "" for letter in values: index = secret_alphabet.index(letter) output += alphabet[index] return output

These blocks of code, depending on how long you’ve been programming might seem a bit confusing. But they really aren’t.
We first create a variable to hold our output. Then we cycle through each letter in our plain message.
For each character we get the position, or index of the character in the normal alphabet, but instead use that to take a letter from our secret alphabet.

To decode a already encoded string, it’s basically the same program. Except instead of getting the position of the letter in the normal alphabet, we get the position of the letter in our secret alphabet and then replace it with the letter from our secret output.

Now we can encode and decode the inputed string and print the results for the user.

result1 = encode(values) result2 = decode(values) print("Encoded: " + result1) print("Decoded: " + result2)

3. Guess my Number

A number guessing game is very simple and easy to make, and we’ll only need a single library, random

import random

That is pretty simple. Now we can use it to generate a random number

number = random.randint(1, 10)

This will generate a random integer between 1 and 10

We’ll also create a variable to hold how many guesses the player has to get the number correct.

guesses = 5

And then for the game, a while loop in which we will ask the user for their guess. Convert that guess into a number and check if it matches the number the computer generated.
If it does not, we can then check the number is higher or if it is lower, and let the user know.

while guesses != 0: print("Guesses Left: " + str(guesses)) guess = int(input("Guess: ")) if guess == number: print("Yay! You won!") exit() elif guess > number: print("Guess is too high!") elif guess < number: print("Guess is too low!") guesses -= 1

Finally outside of the loop. We can add text to let the user know that they are out of guesses. Since the loop will only stop when guesses are equal to zero.

print("You ran out of guesses!")

4. Notes

Here is a more advanced project, but still pretty easy. This will be using a .txt file to save some notes. The first thing we need to do is to create a txt file in your repl, name it notes.txt or whatever else you like.

Opening and writing to files in python is pretty easy. There are a couple of ways to read and write from a file, but the easiest is like this:

with open(file, mode) as file: file.write(data) data =

Changing file to the name of your file of course, and mode to the mode you want to open the file in.
There are a couple of different modes, the main important ones are:

x create the file
w write to the file
r read from the file
a+ add something to the file

If you simply use write mode it will erase everything else in the file.

First we ask if you want to read or write notes.

print("[1] Read Notes") print("[2] Write Notes") print("[3] Clear") choice = input("--> ")

If you want to read your notes, we can open the file and print the contents

if choice == "1": with open("notes.txt", "r") as file: contents = print(contents)

Or if we want to write to the file. We can get the input of what we want to write, and then append that to the end of our file.

elif choice == "2": note = input("Note: ") with open("notes.txt", "a+") as file: file.write(note+"\n") # \n is used to create a new line. That way all the notes aren't printed on the same line.

And finally if we want to clear the file. We can open it in write mode and write nothing, which will erase everything in the file.

elif choice == "3": with open("notes.txt", "w") as file: file.write("")

And that’s all there is to it. Reading and writing to files has all sorts of uses from saving data to building chat applications and more.

5. Random Dare Generator

Who doesn’t love a good dare? Here is a program that can generate random dares.
First, as you might guess, we import random.

import random

Next we can make some lists to hold pieces of text which we will later add together to generate a dare.

list1 = ["jump on", "sit on", "stomp on", "throw salt on", "dance on", "lick", "kick", "sniff"] list2 = ["your cat", "your dog", "your neighbor", "your dad's car", "your mom's car", "a telphone pole", "a fridge"] list3 = ["your mom", "your dad", "your best friend", "your teacher", "the president of the United States", "your crush", "your worse enemy"]

Next we’ll generate a random dare from that list.

dare = "I dare you to " + random.choice(list1) + " " + random.choice(list2) + " in front of " + random.choice(list3)

And finally print the dare out for the user to act upon.


That’s it, a quick and simple dare generator. You can easily expand it by making the dare more complex, maybe with more parts, or by expanding the lists for more possibilities.

That’s all!

That’s it for this tutorial. I’ll try and be better about keeping it updated so that people don’t come here only to find the code is outdated and broken. Also when I first made this tutorial I was a lot less skilled in programming then I am now, so I used a lot of techniques that are really terrible, most of which I’ve fixed.

With most of this code there is a couple of ways you could slim things down and make things a bit more efficient and stuff (although with small stuff like this there isn’t much to do to make this efficient)

There are also some things you can do to make this stuff “cooler” such as adding colors and clearing the screen and such to make things display a little more comfortably for your eyes.

And even though those things aren’t too difficult to do, I wanted to keep these examples/mini games really really simple so anybody can make them and learn from them. Once you can build all these and understand them you should try and expand on this knowledge. You can add colors, make the mini games more advanced and interactive, or use these concepts to build more complicated things.

So good luck with your coding journey! Stick with it and you’ll be thankful you did.

Code Example:

Tutorial Examples - Replit

Again if any of those code doesn’t work or you have trouble with it, go ahead and let me know, I’ll do my best to help.

Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon


Profile icon



Profile icon


No Prob!

Profile icon

thank you for posting this!!

if you didn't i would have spent an hour looking for how to teach my student how to make text based games.

Profile icon

No problem


Profile icon

Hello sir, thank you for contributing these projects. I believe I have found and error in the TEXT ENCODER. Line 14 reads "return ouput" when it should say "return output". Cheers!

Profile icon

whenever i try ur codes it put error..? pls fix

Profile icon

The same happens with me

Profile icon

see if you may be just copy pasting the syntax.It doesn't work sometimes if you just copy paste the syntax.You will need to type your syntax.Hope it will help...

Profile icon

I really need to update this. If you just copy and paste the code in the tutorial and not the linked repls, it won't run becuase when I wrote the tutorial my mac converted all the quotes to smart quotes, which IDE's don't recognize.

Profile icon

I fixed the code

Profile icon


Profile icon


Profile icon