Sitemap
Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.

Member-only story

Learn about Recursion Using Python

7 min readMay 4, 2022

--

Press enter or click to view image in full size
Photo by Chantal Lim on Unsplash

Hi all, today we are going to talk about recursion, a very strange and difficult topic for most students in Computer Science programs. However, recursion is a tool that can make our lives easier in many cases. In this article we are going to cover the following topics:

1. Introduction & Motivation
2. Factorial Calculator (Pen and Paper)
3. Factorial Calculator using Python
4. Fibonacci series (Pen and Paper)
5. Fibonacci series using Python
6. Conclusion

We have a lot of work to do, so let’s get started.

Introduction & Motivation

First of all, Recursion is a process in which a function calls itself. The corresponding function is called the recursive function. Using recursive functions, we are able to solve certain problems, such as tree traversal, sort of arrays (Merge Sort, Quick Sort), etc. In recursion, we try to solve a problem by breaking it into smaller and simpler sub-problems. This technique is known as Divide and Conquer in Computer Science.

Αs we shall see later, instead of using recursion, we can use traditional iterative approaches to solve the same problem. However, by using recursive functions we make our code cleaner…

--

--

Andreas Soularidis
Andreas Soularidis

Written by Andreas Soularidis

Hi, my name is Andreas and I'm passionate about Programming, Algorithms, Machine Learning, Semantic Web, and IoT.

Python in Plain English
Python in Plain English

Published in Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.