# #39 Python Tutorial for Beginners | Factorial

///#39 Python Tutorial for Beginners | Factorial
• ## #39 Python Tutorial for Beginners | Factorial  Add to favorites

Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist :
Python Tutorial in Hindi :

Github :-

Editing Monitors :

Check out our website:

Telusko :
Navin Reddy :

Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20

source

By |2020-09-02T09:14:55+00:00September 2nd, 2020|Python Video Tutorials|47 Comments

1. Rahul Agarwal September 2, 2020 at 9:14 am - Reply

i want to make a code for making a code language. i tried a lot but i failed every time. plss make a video on that too

2. Saurav Narang September 2, 2020 at 9:14 am - Reply

def factorial(a):

for i in range(1,a):

a = a*i

print(a)

factorial(10)

3. Jay patel September 2, 2020 at 9:14 am - Reply

length=int(input('Enter the lenght: '))
num=int(input('Numbers: '))
f=1
for i in range(1,length+1):
f=f*i
print(f)
if i == length:

4. Jay patel September 2, 2020 at 9:14 am - Reply

a=0
b=1
n=int(input('Enter how many'))
print(a)
print(b)
for i in range(n):
a+=b
b+=a
print(a)
print(b)

5. Bilol Normuminov September 2, 2020 at 9:14 am - Reply

def fact(n): return 1 if n == 0 else n * fact(n – 1) if n > 0 else None

6. Aayush Sharma September 2, 2020 at 9:14 am - Reply

def tino(n):

f=1

for i in 5,2,3,4:

f=f*i

return f

x=5

result=tino(x)

print(result)

Y this code is giving an output value of 5 ?

7. Laith Wahib September 2, 2020 at 9:14 am - Reply

ef fact(n):

x = n

r = 1

while x >= 1:

r*=x

x-=1

print('the result is {}'.format(r))

f = int(input('please input the value of your nummber to accont the factorial'))

fact(f)

8. abhishek tripathi September 2, 2020 at 9:14 am - Reply

Man, best python series.

9. Suvir Arora September 2, 2020 at 9:14 am - Reply
10. Noor Khan September 2, 2020 at 9:14 am - Reply

Best Explanation and Teaching Method. Simply Awesome!!

11. Souvik Mallik September 2, 2020 at 9:14 am - Reply

Why do I need to specify x =4?
I mean I can directly put result = fact(4)

12. ii. B. Sasi kumar Raju September 2, 2020 at 9:14 am - Reply

I gain more persistence after watching ur python videos sir tq sir…..🤝🤝

13. ii. B. Sasi kumar Raju September 2, 2020 at 9:14 am - Reply

I'm little bit miserable sir bcz I did some errors in coding anything errors means coding right so no problem I practice more examples tq sir for giving such a life platform……👌👌🙏🙏

14. Pubg Gaming September 2, 2020 at 9:14 am - Reply

Thank you very much Sir. After watching your videos I have not any confusion

15. Dhruvin Lohar September 2, 2020 at 9:14 am - Reply

16. Daksh Dagar September 2, 2020 at 9:14 am - Reply

print("program to find factorial of numbers")
n=int(input("enter a number to find factorial "))
def fact():
i=1
f=1
while i<=n:
f=f*i
i+=1
print(f)
fact()

17. Nikhil Patnaik September 2, 2020 at 9:14 am - Reply

# FACTORIAL
def Fact(y):
f = 1 if y == 1 else y * Fact(y – 1)
return f
m = Fact(int(input("Enter a number: ")))
print("Factorial of the number is: "+str(m))

18. Vijay Sahal September 2, 2020 at 9:14 am - Reply

nice 👍👍👍

19. nayana NR September 2, 2020 at 9:14 am - Reply

tried like this

def fact(n):

result=1

while n>=1:

result*=n

n-=1

return result

a= int(input("enter a positive number: "))

result= fact(a)

print("factorial of given number is: ", result)

20. gaurav gupta September 2, 2020 at 9:14 am - Reply

def fact(n):
f = 1
if n == 0:
return 1
for i in range(1, n + 1):
f = i * f
return f
def fact_recursion(n):
if n == 0:
return 1
else:
return (fact_recursion(n-1) * n)

n = 10
result = fact(n)
print('Factorial of number {} is {}'.format(n, result))
result = fact_recursion(10)
print('Factorial of number {} is {}'.format(n, result))

21. kiyan km September 2, 2020 at 9:14 am - Reply

Thank you 😊❤️

22. Shajahan Smart September 2, 2020 at 9:14 am - Reply

n=int(input("enter "))

k=1

for i in range(n):

k=k*n

n-=1

print(k)

23. RAVI KRISHNA September 2, 2020 at 9:14 am - Reply

print c we may get the ans

24. Kyle Heinz September 2, 2020 at 9:14 am - Reply

Great teacher! Thank you

25. ii. B. Sasi kumar Raju September 2, 2020 at 9:14 am - Reply

Amazing sir…… 👍👍

26. Hackerxx spacex September 2, 2020 at 9:14 am - Reply

HERE IS AN EASIER CODE FOR BEGINNERS

factorial = 1
fac = int('Enter any number: ')
if fac == 0:
print('0! = 1)
else:
for x in range(1, fac + 1) :
factorial = factorial * x
print((str(fac) + '! = ') + str(factorial))

27. syra awan September 2, 2020 at 9:14 am - Reply

n=5

x=n-1

for i in range(1,n):

result=n*x

x=x-1

n=result

print(result)

28. vasu srinivas September 2, 2020 at 9:14 am - Reply

It's simply awesome sir

29. All those who studied c++ know whats recursion.

30. HELLO SIR, I am getting issue while debugging anycode….can u please resolve my issue regarding debugging process.

31. Yash Surana September 2, 2020 at 9:14 am - Reply

If the factorial of a number is given, find the number whose factorial it is?
For eg. find the number whose factorial is 120.
How do we solve this?

32. Gaurav Kumar September 2, 2020 at 9:14 am - Reply

In case of recursion:
x = int(input())

def factorial(n):
if n <= 1:
return 1
else:
return n * factorial(n-1)

print(factorial(x))

33. Ishan September 2, 2020 at 9:14 am - Reply

def fact(num):

a=1;

for i in range(1,num+1):

a=a*i

return a

num=int(input("enter the number"))

a=fact(num)

print(a)

34. Chirag Dhabhai September 2, 2020 at 9:14 am - Reply

def fac(n):
c=1
for i in range(n,1,-1):
c=c*i
print(c)
fac(5)

35. Yash Sharma September 2, 2020 at 9:14 am - Reply

x=0

n=int(input("Enter the number whose fact you want to find"))

for i in range(n,1,-1):

if(i==n):

x=n

else:

n=n*i

print("Factorial is…")

print(n)

quit()
Tried something different….

36. WaterisGood September 2, 2020 at 9:14 am - Reply

this is a advice for ur channel mate, talk slower and try to wipe that english from ur lips,so u talk cleaner , no ofennce just saying , it will impruve the view

37. hemanth b September 2, 2020 at 9:14 am - Reply

n=int(input('enter a num'))
F=1
for i in range(1,n+1):
F=F*i
print(f)

38. Angelo Travi September 2, 2020 at 9:14 am - Reply

from math import *

x = int(input("Factorial of this number"))

k = factorial(x)
print("the factorial of {} is {}".format(x, k))

def fattoriale(n):

p = n
if n == 0:
return 1
else:
for i in range(1, n):
p *= i
return p

print("the factorial of {} is {}".format(x, fattoriale(x)))

39. shubham singh September 2, 2020 at 9:14 am - Reply

#not geeting the result ??
def fact(n):

f=1

for i in range(1,n+1):

f=f*i

return f

x=5

result= fact(x)

print(result)

output:-
1

40. sharup sheikh September 2, 2020 at 9:14 am - Reply

The factorial of 0 is also 1 which means we have to use if statement too

41. hozaifa shakeel September 2, 2020 at 9:14 am - Reply

my code for finding factorial->
a=int(input("enter the number:"))

def fac(a):

b = 1

for i in range(1,a+1):

b=b*i

print(b)

fac(a)

42. Karthi M September 2, 2020 at 9:14 am - Reply

you got great acting skills n also you have an amazing future in cinema man

43. Sreerag Raj September 2, 2020 at 9:14 am - Reply

this code not working

44. Ritika Sharma September 2, 2020 at 9:14 am - Reply

No one can beat you in teaching python thanku ❤️

45. YASH MUNDANKAR September 2, 2020 at 9:14 am - Reply

def fact(n):

f=1

for i in range(1,n+1):

f=f*i

print(f)

n=int(input("Enter the number you want"))

fact(n)

46. Shivansh Singh September 2, 2020 at 9:14 am - Reply

n = int(input("Enter the factorial number"))
def fact(n):
f = 1
for i in range(1,n+1):
f = f * i
return f

result = fact(n)
print(result)

47. Riyaz D September 2, 2020 at 9:14 am - Reply

Hi naveen in python how to make a variable private as in java??