Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

#41 Python Tutorial for Beginners | Factorial using Recursion

477.7K views on YouTube

In this lecture we will learn:
– Recursion in Python
– Find the factorial of a number by using the recursion
– How the function inside a function works?
– Logic for finding the factorial using recursion

#1
– Recursion is a function calling itself.
1. Create a variable to store the factorial of a number.
2. Assign the variable by the fact() function and pass a number in it as an argument.
3. Print the value of the variable to get the result.
4. Define the function say fact() above the main code.
– A function can be defined by using the keyword def.
def fact(n):
5. Call the same function inside the fact() function by applying the correct logic and return its value.
return n*fact(n-1)
6. Apply the condition for the factorial of a 0 as it is always 1.
– In this way, the factorial of a number will be printed by using the recursion.

Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist : https://www.youtube.com/watch?v=hEgO047GxaQ&t=0s&index=2&list=PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3
Python Tutorial in Hindi : https://www.youtube.com/watch?v=JNbup20svwU&list=PLk_Jw3TebqxD7JYo0vnnFvVCEv5hON_ew

Github :- https://github.com/navinreddy20/Python-

Check out our courses:

Agentic AI Engineering with Python : https://go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)

Master Java Spring Development : https://go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)

For More Queries WhatsApp or Call on : +919008963671

website : https://telusko.com/

Udemy Courses:

Java Spring:- https://go.telusko.com/Udemyjavaspring
Java:- https://go.telusko.com/udemyteluskojava
Spring: https://go.telusko.com/udemyteluskospring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopython
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodocker

Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
Discord : https://discord.gg/D8hWe9BqfF

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20