Python Program to Find the Factorial of a Number Tutorial

preview_player
Показать описание
In this Tutorial you will learn to write a Python Program to find the factorial of a number using Iterative Method ( for loop ).

The factorial of a positive integer n, which is denoted as n!, is the product of all positive integers less than or equal to n.

That is n! = n * (n-1)*(n-2)*....*3*2*1

So 4! = 4 * 3 * 2 * 1 which is equal to 24.

Factorial for the numbers 0 and 1 is 1. That is 0! = 1 and 1! = 1.
For negative numbers factorial value doesn't exists.

our Social Media Pages

Our Website

#ExampleProgram
Рекомендации по теме
Комментарии
Автор

I love your explanation. Most videos I've come across do not explain this thoroughly. keep it up!

mohamedh.
Автор

I like the use of range function in the context of factorial. Very nice job!

Roboticdock
Автор

loved your explanation I was literally searching for an explanation for the factorial. Couldn't get any clearer.

shreyasahu
Автор

This channel is so underrated!
Share!

rajuthoppil
Автор

clear and the best explanation in the YouTube. Thank you.

sharonmutiso
Автор

I really enjoyed the way you explained the concept of factorial. dont you mind creating a python playlist where u will be doing similar task. I could learn a lot from you.

likhomava
Автор

Best Explaination till now in Youtube!!1❤😍

dishamehta
Автор

You explained this very well, thanks!

demopoint
Автор

I liked the latter part. Keep it coming

ShadeWhite_kay
Автор

such a very clear and easy to understand video. Thank you

vovantrung
Автор

Awesomely done and explained! Well done brother

rotes
Автор

Bruh! your are good at explaning codes

mugisha_art
Автор

Good explanation of factorials. Thanks.

JJJJ-gluf
Автор

Sir, where would u put the exit statement if i want to execute this program again n again until the user wans to exit the program.

kapilthapa-oy
Автор

Hello, what software do you use to draw/write numbers with highletrs? You used it in this video.😀🤩

ataberdi
Автор

number=int(input("Enter a number:"))

factorial=1

if (number < 0):
print("cant compute factorial of negative number")
elif (number <2):
print("{}!={}".format(number, factorial))

else:
for i in range(number, 1, -1):
# print(number)
factorial=factorial*number
print("{}!={}".format(number, factorial))

output:Enter a number:4
4!=64


The output of this program is coming wrong it should be 24

ankitadeore
Автор

Thanks, a very good explanation step by step.
How to make this as application in GUI Tkinter

autarroy