Find the Factorial of a Number In Python(Iterative v.s Recursion)

preview_player
Показать описание
Hi everyone! In this video, I will show you how to find the factorial of a number! Then, I will write the program in python to find the factorial of a positive integer using the iterative and recursive solutions.

First of all, what exactly is factorial? It's very easy. If you want to find the factorial of 5, then we write it as 5!= 5 x 4 x 3 x 2 x 1 = 120. Note that 0! = 1

What is recursion? Recursion is a function that calls upon itself. Here, we write a function that calls upon itself to binary search an element or value inside an array using a for loop and using recursion. While it is easy to use a for loop or while loop to do this, it is important that you understand these recursion steps to have a strong foundation to learn more complex recursive algorithm in the future.

In the next video, I will explain how to find the sum of a number iteratively and recursively. For example, sum(4) = 4 + 3 + 2 + 1 = 10

LIKE & SUBSCRIBE:
Рекомендации по теме
Комментарии
Автор

thank you so much quoc dat phung you helped me so much in school

oranjar
Автор

Hey can you do a video on series in calculus II please? Would be very much appreciated!

Kller-Karim