Python for Kids
Blogs, articles, free Python projects and more for kids and teens learning to code with 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 moreMay 21 2022
A stack is a last-in-first-out (LIFO) data structure. Learn the many ways to create a stack in Python.
Read moreMay 21 2022
A queue is a first-in-first-out (FIFO) data structure. Learn the many ways to create a queue in Python.
Read moreMay 19 2022
Python loops are so expressive that you can do two things at once: count and iterate!
Read moreMay 19 2022
Have a Python string and need to remove parentheses from it? Learn three ways to do so!
Read moreMay 19 2022
Have two or more lists and need to iterate through them simultaneously? Here are the ways.
Read moreMay 18 2022
Looking for a quick way to compare two dictionaries in Python? Learn how!
Read moreMay 18 2022
Can you write an interactive Python program to take inputs from the user till the Enter key is pressed? Learn how!
Read moreMay 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 moreMay 10 2022
Python’s sum function takes an iterable and returns the sum of elements in it. Learn how to use it!
Read moreMay 9 2022
Learn about four different ways to split a text file in Python into lines. Which one is your favorite?
Read moreMay 9 2022
Have a Python set and want to convert it into a tuple? Learn three ways to do so!
Read moreMay 4 2022
Have a Python string denoting a decimal and need to remove trailing zeros? Learn how!
Read moreMay 4 2022
Have a Python string denoting a number and need to remove leading zeros? Learn how!
Read moreApr 3 2022
Stacks are one of the most useful data structures in Python. Learn how to use them!
Read moreApr 3 2022
How should you name your Python files, functions, classes, modules, and packages? Read on to learn how!
Read moreFeb 20 2022
Can you have a Python program where a method has different meanings at different points in a program? Yes!
Read moreFeb 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 moreFeb 20 2022
Would you like to time your Python program to see how fast it runs? Learn about ways to measure elapsed time!
Read moreFeb 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 moreFeb 18 2022
Have a Python set and want to pop an element? Here’s how to do it!
Read moreFeb 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 moreFeb 18 2022
Learn how to print any object into a string using Python’s custom methods!
Read moreFeb 17 2022
It is sometimes handy to take an object and convert it into a string. Learn Python’s very useful str() function!
Read moreFeb 17 2022
Have a string and need to check if it actually denotes an integer? Here are 4 ways to do so!
Read moreFeb 15 2022
If you dabble in Python lists, here are useful ways to prepend elements to a list!
Read moreFeb 15 2022
Do you know the difference between 5/2 and 5//2 in Python? When do you use which operator?
Read moreFeb 13 2022
Learn how to write boolean expressions using Python’s in built boolean operators!
Read moreFeb 13 2022
Private methods in a Python class are a good way to encapsulate functionality. Learn when you can make use of them!
Read moreFeb 9 2022
Python has versatile ways to format strings, i.e., to create strings from templates. Learn how they work!
Read moreFeb 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 moreFeb 8 2022
Learn about Python’s special method __call__ which makes objects callable, leading to more readable code!
Read moreFeb 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 moreFeb 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 moreFeb 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 moreJan 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 moreJan 31 2022
Ever wonder how Python stores characters internally? Learn about the Python chr() function!
Read moreJan 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 moreJan 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 moreDec 30 2021
Learn about 8 different ways to initialize a Python dictionary. Which one is your favorite?
Read moreDec 30 2021
Learn how to work with empty dictionaries in Python: creating them and testing for emptiness.
Read moreDec 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 moreDec 30 2021
If...else statements are important to any Python programmer; the inline if is a shorthand that leads to more readable statements.
Read moreDec 30 2021
Memory errors can occasionally happen in your Python program. Learn four reasons why they happen and how to to fix them.
Read moreDec 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 moreDec 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 moreDec 30 2021
The XOR operator in Python computes the logical exclusive disjunction of two boolean variables or two binary numbers.
Read moreDec 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 moreDec 28 2021
Learn about the many ways to copy a list in Python and which one to use in a given setting.
Read moreDec 28 2021
Python startswith() is a very handy method to check if a string starts with a certain prefix.
Read moreDec 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 moreDec 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 moreDec 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 moreDec 27 2021
Checkout this handy tutorial to create empty lists in Python or check if a given list is empty.
Read moreDec 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 moreDec 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 moreOct 26 2021
Concatenating strings refers to joining them one after the other. Python provides multiple ways to concatenate strings.
Read moreOct 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 moreOct 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 moreOct 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 moreOct 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 moreSep 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 moreSep 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 moreSep 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 moreAug 2 2021
Learn why Python is one of the most popular programming languages out there and the myriad places where it is used.
Read moreJuly 19 2021
Python’s sqrt() computes square roots and you can use it in interesting ways to solve mathematical problems.
Read moreJuly 18 2021
Python’s print() is a versatile function that provides various options to format and style the output from your programs.
Read moreJuly 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 moreJuly 15 2021
Magic squares add up to the same number along rows, columns, and diagonals. Here is a Python program to generate them.
Read moreJuly 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 moreJuly 13 2021
Learn about the Python pygame library and its capabilities.
Read moreJuly 10 2021
Arrays and Lists are two very similar data structures in Python but have important differences. Read on to learn about them!
Read moreJuly 9 2021
Learn about this ancient mathematical puzzle and the classical computer science solution to it, along with a Python implementation.
Read moreJuly 8 2021
Learn to write your own Python program that will generate a random password.
Read moreJuly 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 moreJuly 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 moreJuly 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 moreJuly 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 moreJune 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 moreJune 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 moreJune 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 moreJune 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 moreDec 10 2019