When I first started my python journey, I was about 12 years old. As a kid, it was always easy to memorize nameless syntax and dozens of lines of code, but I always found it difficult to apply my knowledge to create something tangible. It wasn’t until I was introduced to python projects that I began to understand the language as a tool. Learning python isn’t necessarily hard, but like learning any new skill mastering it takes time, practice, and patience. For those just starting their python journey, especially kids, it can be helpful to have some fun projects to work on to help python stick. This article will provide five different beginner python projects for kids that are both fun and easy!
Before you dive right in!
If you’re just starting out with python, it might serve more harm than good to just start working on these projects without any guidance. This article will provide brief descriptions of each project as well as the necessary python code, however, if you need a more comprehensive guide there are plenty of fantastic python tutorials out there that can help get you started.
Once you’ve got the basics down feel free to come back and tackle these five-fun kid-friendly python projects!
Project #1: Interactive quizzes:
This python project is perfect for kids who are just starting to learn the basics of python. With this project, they can create an interactive quiz that functions off on user input to give the user a personalized result based on their previous answers. This is a great way to help them memorize python syntax and begin thinking logically with code. Let’s start with some pseudo-code to give you an idea of how this project will work. Remember, if you feel confident with the overall idea go ahead and attempt it on your own, if not the pseudo-code below will provide some guidance.
Pseudo-code:
Basics-
1.Make a file named quiz.py
2.Select some sort of theme/idea-->
which marvel character are you? what movie genre suits you best? pseudo code for "which marvel character are you?"
program asks for user name program asks question 1
if answer to question 1 is 1- program asks question 2
if answer to question 2 == 1 you are superhero 1
if answer to question 2 ==2 you are superhero 2
if answer to question 1 is 2
program asks a different question 2 if answer to question 2 ==1
you are superhero 3
if answer to question 2 ==2 you are superhero 4
Pseudo-code: Code that is not yet functional but gives the programmer an idea of how the final product will work.Now that we have a good idea of what we want to do, we can start translating our pseudo-code into python code! If you haven’t already, go ahead and attempt the problem on your own before moving on to the next section.
Project #1 Python code:
name = input ('what is your name:')#name of user is saved in the variable name
Q1 = input (' " how would you deal with thanos if you were a real marvel character? Fight him (1) or negotiate with him (2):') #if/then
if Q1 == '1': #we saved the answer to the previous question in the variable Q1 so it is easy to reference again Q12 = input ('some people think Loki is a villain some dont, what do you think? Villain (1) or not (2): ') #Q12 represents the path were on- path 1, question 2; this system makes sure we dont resuse multiple variables if Q12 == '1':
print (name, 'you are: IRON MAN') # if Q12 == '2':
print (name, 'you are: THOR')
elif Q1 == '2': #remember answers from input statements are strings
Q22 = input ("Whats cooler? Super strenght (1) or cool gadgets (2):") #same system as Q12- path 2, question 2
if Q22 == '1':
print (name,'you are: The HULK') if Q22 =='2':
print (name, 'you are: The Black Widow')
Here’s what the output might look like —
what is your name: Bob
how would you deal with thanos if you were a real marvel character? Fight him (1) or negotiate with him (2):1 some people think Loki is a villain some dont, what do you think? Villain (1) or not (2): 2
Bob you are: THOR
While this is the perfect beginner python for kids project some may find it a bit too easy. If that’s the case, don’t worry! You can always upgrade your program by having more questions or more answer choices. You could also take it a step further and make a choice- your own adventure game!
Project #2 – Password Generator:
We’ve all been in a situation where we can’t think of a good password, or we use the same one for everything and then forget it. This python project is a great way to help Kids learn how to generate random passwords that are both strong and easy to remember! This program will use lists in python and functions to create a random password.
First, let’s look at our pseudo-code.
Pseudo-code:
Basics-
Make a file named passgenerator.py pseudo code for passwork generator
Make a list of all characters
ask user how many characters they would like to use
randomly shuffle all values in characters print as many characters as the user wanted
Remember your Pseudocode doesn’t need to be perfect! Again, if you haven’t already attempted the problem on your own, give it a shot before moving on to the python code section!
Project #2 python code:
import random
characters= ['!','@','#','$','%','^','&','*','+',':','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h']
lenght = int (input ('number of characters'))
random.shuffle(characters) #feature of the random function
char = (characters[0:lenght]) #index out first character to the lenght entered charjoint = ''.join(char) #joins the individual elements of char into one string print (charjoint)
Your output might look something like this —
number of characters 5
e1%9c
Now that you know how to make a password generator, try upgrading your program by adding special characters or making the passwords longer, maybe even a feature that allows a user to customize a password.
Project #3 – Cypher program:
This python project is perfect for kids who are interested in cryptography! With this program, they can encode a string of text into a secret message. This is done by substituting each letter of the original message with another letter that is a certain number of letters away from it. For example, if the shift value is two and the original message is “ABC”, the encoded message would be “CDE”. This would allow kids to create their own cool secret messages!
Pseudo code:
Basics-
1.Make a file named cypher.py
2.We cant just add numbers to a letter which means we need to convert the letter to a number, add and then convert again all we have to do is convert the numbers back to ASCII code, using Ord() and then the other way around using Char()
pseudo code for cypher program: ask for phrase (input)
ask for shift
separate out characters in a string convert characters to ascii using ord add value to ascii integer
convert back to char
put characters back together to make a final string
Project #3 python code:
phrase = input ('plain text:')
shift = int (input ('shift:')) #make the shift an integer so we can add it later phrase_list = list ()
for letter in phrase:
con_char = int (ord (letter)) #ord () converts characters to ascii new_char = con_char + shift #adding converted characters to the shift char = chr(new_char)
phrase_list.append (char)
E_phrase =''.join(phrase_list) #combine the list to make a string print ('Encrypted phrase:',E_phrase)
Your output might look something like this —
plain text: Hello World shift:2
Encrypted phrase: “Jgnnq”Yqtnf
Now that you know how to make a simple cypher program, try upgrading it by adding the option to decode a message as well!
Project #4 – Online Dice:
Imagine playing a board game but the most important part is missing… the dice! This python project is a great way to bring the fun of board games back into your life. With this program, you can roll virtual dice that are generated randomly using python’s rand function. This is a great way to teach kids about how the python rand function works and how it can be used in different ways!
Pseudo- code:
Basics-
1.Make a file named dice.py
2.We need to import random
pseudo code for Dice Program: while the user wants to continue
ask if the user wants to use the dice if they say yes
randomly pick a number 1-6 print that number
ask if they want to continue
Project #4 python code:
import random as rand
cont = 'yes' #so that the while loop runs when the program starts while cont == 'yes':
print (' you rolled a:',rand.randint (1,6))
cont = input ('do you want to continue ') #if the user says no the program will stop print ('all done!')
Your output might look something like this —
you rolled a: 2
do you want to continue yes you rolled a: 3
do you want to continue yes you rolled a: 1
do you want to continue no all done!
Now that you know how to make an online dice, try upgrading it by adding features that allow you to roll multiple dice at once or choose the number of sides on the dice!
Project #5 – “Rock, Paper, Scissors,”
This python project is perfect for kids who are interested in making games! With this program, they can create a basic version of the popular game “Rock, Paper, Scissors”, using if/then statements, the random function, as well as user input. This is a great way to teach kids about how python can be used to create simple games.
Pseudo code:
Basics-
1.Make a file named RockPSGame.py
2.Import random
pseudo code for the Rock Paper Scissors program: import random
randomly generate a number 1-3
if the number is 1, computer chose rock
if the number is 2, computer chose scissors
if the number is 3, computer chose paper ask for the users choice
tie if computer and user choose the same if user chooses rock:
if computer chooses scissors- user wins if computer chooses paper- computer wins
continue with all other options
Project #5 python code:
import random as rand #rock =1
#scissors = 2
#paper = 3 cont = 'yes'
while cont == 'yes': #added a while user wants to continue loop c_choice = rand.randint (1,3) #randomly generates
u_choice = int (input ('your move, rock =1, scissors = 2, paper = 3 ')) #possible plays
if c_choice == u_choice: print ('ITS A TIE')
elif u_choice == 1: if c_choice == 2:
print ('YOU WIN, ROCK DESTROYS SCISSORS!')
else:
print ('YOU LOSE, PAPER SMUSHES ROCK!')
elif u_choice == 2: if c_choice ==3:
print ('YOU WIN, SCISSORS TEARS UP PAPER!')
else:
print ('YOU LOSE, ROCK DESTROYS SCISSORS')
elif u_choice == 3: if c_choice == 1:
print ('YOU WIN, PAPER SMUSHES ROCK')
else:
print ('YOU LOSE, SCISSORS TEARS UP PAPER')
#continue prompt
cont = input ('do you want to continue') #if user says no program will stop print ('DONE! Thank you!')
Your output might look something like this —
your move, rock =1, scissors = 2, paper = 3 3 ITS A TIE
do you want to continueyes
your move, rock =1, scissors = 2, paper = 3 1 YOU LOSE, PAPER SMUSHES ROCK!
do you want to continueyes
your move, rock =1, scissors = 2, paper = 3 2 YOU WIN, SCISSORS TEARS UP PAPER!
do you want to continueno DONE! Thank you!
Now that you know how to make a basic version of “Rock, Paper, Scissors”, try upgrading your program by adding more options such as “Lizard, Spock” or by keeping track of the score. For learning more fun and easy Python projects Book a FREE trial class today!
There you have it! Five python projects for kids who are just starting to learn to code. These projects are a great way to teach kids about how python can be used in different ways as well as practical applications for python. If your child is interested in learning more about python, join online coding classes for kids at SkoolofCode. And as always, if you have any questions or comments feel free to reach out to us at learn@skoolofcode.us, we would love to hear from you!
Happy Coding! 🙂
By – Prisha Sood