Python for Kids

Blogs, articles, free Python projects and more for kids and teens learning to code with Python.


How to merge multiple files into a single file in Python

May 21 2022

Given two or more files how do you merge them into a single file? Learn to write a Python program to do just that!
Read more
How to implement a Stack in Python

May 21 2022

A stack is a last-in-first-out (LIFO) data structure. Learn the many ways to create a stack in Python.
Read more
How to initialize a Queue in Python

May 21 2022

A queue is a first-in-first-out (FIFO) data structure. Learn the many ways to create a queue in Python.
Read more
How to count in a Python loop

May 19 2022

Python loops are so expressive that you can do two things at once: count and iterate!
Read more
How to remove parentheses from strings in Python

May 19 2022

Have a Python string and need to remove parentheses from it? Learn three ways to do so!
Read more
How to iterate through multiple lists in Python

May 19 2022

Have two or more lists and need to iterate through them simultaneously? Here are the ways.
Read more
How to check if two dictionaries are equal in Python

May 18 2022

Looking for a quick way to compare two dictionaries in Python? Learn how!
Read more
How to take input until Enter is pressed in Python

May 18 2022

Can you write an interactive Python program to take inputs from the user till the Enter key is pressed? Learn how!
Read more
Python’s range() function

May 10 2022

Python’s range() function is very handy to write loops because it returns a list of numbers within a specified span of values.
Read more
Python’s sum() function

May 10 2022

Python’s sum function takes an iterable and returns the sum of elements in it. Learn how to use it!
Read more
Splitting a Text File by Lines in Python

May 9 2022

Learn about four different ways to split a text file in Python into lines. Which one is your favorite?
Read more
How to convert a set to a tuple in Python

May 9 2022

Have a Python set and want to convert it into a tuple? Learn three ways to do so!
Read more
How to remove trailing zeros in Python

May 4 2022

Have a Python string denoting a decimal and need to remove trailing zeros? Learn how!
Read more
How to remove leading zeros in Python

May 4 2022

Have a Python string denoting a number and need to remove leading zeros? Learn how!
Read more
Stacks in Python

Apr 3 2022

Stacks are one of the most useful data structures in Python. Learn how to use them!
Read more
Python’s file naming convention

Apr 3 2022

How should you name your Python files, functions, classes, modules, and packages? Read on to learn how!
Read more
Method Overloading in Python

Feb 20 2022

Can you have a Python program where a method has different meanings at different points in a program? Yes!
Read more
Tuple Index Out of Range!

Feb 20 2022

Do you get the dreaded “Tuple Index Out of Range” error in your Python program? Learn what it means and how to fix it!
Read more
Measuring Elapsed Time in Python

Feb 20 2022

Would you like to time your Python program to see how fast it runs? Learn about ways to measure elapsed time!
Read more
Ordered Sets in Python

Feb 20 2022

An ordered set is just like a set in that it disallows duplicates but it maintains the order of elements. Learn how to implement ordered sets in Python!
Read more
Python Set pop()

Feb 18 2022

Have a Python set and want to pop an element? Here’s how to do it!
Read more
How do you measure file size in Python?

Feb 18 2022

You will sometimes encounter the need to measure the size of files from within a Python program. Here are 5 ways to do so!
Read more
Python toString()

Feb 18 2022

Learn how to print any object into a string using Python’s custom methods!
Read more
Python's str() function

Feb 17 2022

It is sometimes handy to take an object and convert it into a string. Learn Python’s very useful str() function!
Read more
Can your Python string be an integer?

Feb 17 2022

Have a string and need to check if it actually denotes an integer? Here are 4 ways to do so!
Read more
Prepending to a list in Python

Feb 15 2022

If you dabble in Python lists, here are useful ways to prepend elements to a list!
Read more
Python’s Double Slash

Feb 15 2022

Do you know the difference between 5/2 and 5//2 in Python? When do you use which operator?
Read more
Boolean Operators in Python

Feb 13 2022

Learn how to write boolean expressions using Python’s in built boolean operators!
Read more
Private Methods in Python

Feb 13 2022

Private methods in a Python class are a good way to encapsulate functionality. Learn when you can make use of them!
Read more
Formatting strings in Python

Feb 9 2022

Python has versatile ways to format strings, i.e., to create strings from templates. Learn how they work!
Read more
How to send emails using Python

Feb 9 2022

Need to send hundreds of emails and looking for a convenient solution? Learn how to use a mail API and Python to programmatically send emails!
Read more
The Python __call__ method

Feb 8 2022

Learn about Python’s special method __call__ which makes objects callable, leading to more readable code!
Read more
Print a Python List (5 ways)

Feb 8 2022

Python is one of the most multifaceted languages out there; learn about 5 different ways to print a list! Which one is your favorite?
Read more
Python hasattr()

Feb 7 2022

hasattr() is a very useful function in Python that can be used to check if a given object has a specified attribute.
Read more
Python's not in operator

Feb 7 2022

'not in' as the name indicates is an operator that checks if a given input is not present in a given sequence. See where we can make use of it!
Read more
Python pow()

Jan 31 2022

What is the remainder when 7 to the power of 49 is divided by 5? Python’s pow() is a handy function to get you the result in one line!
Read more
Python chr()

Jan 31 2022

Ever wonder how Python stores characters internally? Learn about the Python chr() function!
Read more
Python’s min function

Jan 30 2022

Analogous to max(), the min() function in Python takes an iterable (e.g., a list) as input and returns the minimum value in that iterable.
Read more
Python’s max function

Jan 30 2022

The max() function in Python is a versatile function that takes any type of iterable (e.g., a list) as input and returns the maximum value in that iterable.
Read more
Initializing a Python dictionary

Dec 30 2021

Learn about 8 different ways to initialize a Python dictionary. Which one is your favorite?
Read more
Empty Dictionaries in Python

Dec 30 2021

Learn how to work with empty dictionaries in Python: creating them and testing for emptiness.
Read more
Python Dictionary Length

Dec 30 2021

Dictionaries hold key-value pairs in a data structure and it is often useful to find the length of a dictionary. Learn how!
Read more
Python’s Inline If

Dec 30 2021

If...else statements are important to any Python programmer; the inline if is a shorthand that leads to more readable statements.
Read more
Python Memory Errors: Why they happen and how to fix them

Dec 30 2021

Memory errors can occasionally happen in your Python program. Learn four reasons why they happen and how to to fix them.
Read more
Printing to stderr in Python

Dec 30 2021

stderr, or 'standard error', is the channel where error messages from your Python program are recorded. Learn how to print to stderr from your program.
Read more
How to capitalize the first letters of words in a string

Dec 30 2021

Haven’t you found it necessary to sometimes take a string and capitalize the first letter of each word? Here are 5 handy ways to do so.
Read more
Python’s XOR Operator

Dec 30 2021

The XOR operator in Python computes the logical exclusive disjunction of two boolean variables or two binary numbers.
Read more
Python’s If Not Operator

Dec 28 2021

Python’s if not operator tests if some condition is not true and can be a succinct way to describe some types of program logic.
Read more
How to Copy a List in Python

Dec 28 2021

Learn about the many ways to copy a list in Python and which one to use in a given setting.
Read more
Python startswith(): A Simple Guide

Dec 28 2021

Python startswith() is a very handy method to check if a string starts with a certain prefix.
Read more
Python’s isnumeric() method

Dec 28 2021

Python strings sometimes are made up of numbers and can thus be interpreted in a numerical manner. isnumeric() is a very useful method for Python programmers.
Read more
Finding the length of a Python list

Dec 27 2021

How do you find the length of a list in Python? Learn about Python’s built-in len() method and other functions.
Read more
Python's Ternary Operator

Dec 27 2021

Ternary operators in Python are nice syntactic shorthands for conditional statements that make your program more readable. Read on to understand how and when to use them.
Read more
All about Python Empty Lists

Dec 27 2021

Checkout this handy tutorial to create empty lists in Python or check if a given list is empty.
Read more
Writing to a File in Python

Dec 27 2021

Python has very useful functions that make it easy to write to text files and even append to existing files. See how!
Read more
How to Open a Text File in Python

Dec 14 2021

It is easy to use Python to read content from a file and process them in your program. Read on to see how!
Read more
How to Concatenate Strings

Oct 26 2021

Concatenating strings refers to joining them one after the other. Python provides multiple ways to concatenate strings.
Read more
Python Pointers: Do we need them?

Oct 25 2021

Pointers are very common in low-level languages like C and C++ and although you do not need to use them explicitly in Python, understanding how they work behind the scenes will make you appreciate many implementation details.
Read more
Python reduce()

Oct 19 2021

Python’s reduce() function takes a function and uses it to perform a rolling computation over an iterable such as a list.
Read more
Python map()

Oct 19 2021

Python’s map() function can be viewed as a shorthand for a for loop. It takes a function and an iterable (e.g., a list or array) and applies the same function on each element of the iterable.
Read more
Python Set Operations

Oct 17 2021

Discover Python sets! Python provides a very flexible set data structure and a wide range of operations so you don’t have to implement your own.
Read more
The Fibonacci Sequence

Sep 27 2021

Fibonacci numbers are a famous sequence of numbers that occur in many natural contexts. Learn how to generate and experiment with them using Python programs.
Read more
What is a loop in programming?

Sep 27 2021

A loop is a basic building block of coding and is referred to as a programming structure. Let’s take a look at the types of loops and how they are used within a program.
Read more
The Beginner's Guide to Python Turtle

Sep 13 2021

Python’s Turtle is a popular module that provides many useful functions for drawing graphics, animations, and games. Learn how you can command the turtle to draw graphics!
Read more
What is Python used for?

Aug 2 2021

Learn why Python is one of the most popular programming languages out there and the myriad places where it is used.
Read more
The Python sqrt() function

July 19 2021

Python’s sqrt() computes square roots and you can use it in interesting ways to solve mathematical problems.
Read more
The Python print() function

July 18 2021

Python’s print() is a versatile function that provides various options to format and style the output from your programs.
Read more
Recursion in Python

July 17 2021

Recursion is a style of programming where a function calls itself one or more times repeatedly until a desired condition is met. Many classical algorithms in computer science are recursive in nature.
Read more
Magic Square Generator

July 15 2021

Magic squares add up to the same number along rows, columns, and diagonals. Here is a Python program to generate them.
Read more
Pygame Tutorial

July 14 2021

Learn to use the Pygame library in Python to create your first game. This tutorial is meant for beginners looking to get started with Pygame.
Read more
Everything you wanted to know about pygame

July 13 2021

Learn about the Python pygame library and its capabilities.
Read more
Arrays versus Lists in Python: What is the Difference?

July 10 2021

Arrays and Lists are two very similar data structures in Python but have important differences. Read on to learn about them!
Read more
Solving the Tower of Hanoi in Python

July 9 2021

Learn about this ancient mathematical puzzle and the classical computer science solution to it, along with a Python implementation.
Read more
How to make a password generator in Python

July 8 2021

Learn to write your own Python program that will generate a random password.
Read more
5 Algorithms and their popular applications

July 6 2021

Algorithms are pervasive in computer science - read this post to learn about five of the most popular algorithms and their myriad applications.
Read more
Quicksort Primer

July 5 2021

Quicksort is a very popular in-place sorting algorithm so named because it is significantly faster than many other sorting algorithms. Learn about it including an implementation in Python.
Read more
Merge Sort Primer

July 3 2021

Merge sort is a classical divide-and-conquer algorithm. Learn the details of how merge sort works and a sample implementation in Python.
Read more
Insertion Sort Primer

July 2 2021

Insertion sort is a very simple algorithm for sorting, mimicking the way you sort cards in your hand. Get into the details of how Insertion Sort works and a sample implementation in Python.
Read more
Bubble Sort Primer

June 29 2021

Bubble Sort is a very popular and simple algorithm for sorting. Learn how Bubble Sort works and how to implement it using Python.
Read more
Learn Python enumerate()

June 28 2021

Python’s enumerate() function is used to loop through strings, list, arrays and any other iterable object. Use iterators to build a search engine!
Read more
What are algorithms?

June 25 2021

What is an algorithm? How do they surface in our everyday lives? Learn about the history of algorithms, the types of algorithms, and some famous algorithms in computer science.
Read more
How to make a Random Number Generator in Python

June 23 2021

Random numbers are crucial to realism in gaming, cryptography, and simulation. Learn all about random numbers, how they are used, and how to generate them in Python.
Read more
Top 6 Python libraries for kids

Dec 10 2019

Learn about several fun-tastic Python libraries for kids to get into turtle graphics, game playing, machine learning, and more!
Read more
  • ABOUT

Copyright @ Kodeclik 2022. All rights reserved.