#39 Python Tutorial for Beginners | Factorial

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

Python Tutorial to learn Python programming with examples

Editing Monitors :

Subscribe to our other channel:
Telusko Hindi :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Рекомендации по теме
Комментарии
Автор

def main():
a = int(input("enter the number"))
def factorial(n):
print()
b =1
for i in range(1, a + 1):
b = b * i
print(b)
c = input("want to find for onother number=")
if c == "y" or c == "yes":
main()
factorial(a)


main()

rajatbansal
Автор

insted of telusko learnings it should be telusko blessings

satyammhetre
Автор

This programming example is well thought out and kinda refreshing! It helps me to get back to tutorial again!. thanks for your selfless act.

chessbd
Автор

k = int(input("Enter the number to calculate the factoroial "))

j = 1
for i in range(1, k+1):
j = i * j
print ("The factorial of ", k, "is", j)

edisonjoshua
Автор

factorial using while loop


def fac(n):
f=1
i=1
while(i<=n):
f=f*i
i+=1
print(f)
fac(6)

AlankritIndia
Автор

I feel sorry for the first time on youtube about forget to like videos. Thank

gokceozkul
Автор

def fac(n):
if n==0:
return 1

s=1
for i in range(1, n+1):
s=s*i
return s



n=int(input("Enter a no."))
ans=fac(n)
print("Factorial = ", ans)

BhuveshDhiman
Автор

n=int(input("enter any no"))
def fact(n):
for i in range(1, n):
n=n*i
print(n, end=" ")
fact(n)
output
enter any no 5
5 10 30 120

shaunakshukla
Автор

Easiest Answer
x = int(input("Enter a Number: "))
result = 1
for i in range(x):
result = result * (x - i)
print(result)

Killa
Автор

No one can beat you in teaching python thanku ❤️

ritikasharma
Автор

def fact(n):
if n < 0:
print('Should be +ve number')
else:
a = 1
for i in range (1, n + 1):
a = a * i
return a


x = int(input('give a number for factorial = '))
result = fact(x)
print('the factorial of ', x, 'is = ', result)

sumankumarkarmakar
Автор

factorial in my way sir!
def facto(num):
e = 1
for i in range(1, num+1):
e *= i
print("factorial of ", num, '! is ', e)
user = int(input("Enter which number factorial you want : "))
facto(5)

karthikkeyansmk
Автор

factorial without functions::

x = int(input("enter a number"))
z=1
while x>0:
z=z*x
x=x-1
print("factorial of x is", z)

gouripeddipawansreekar
Автор

z = int(input('enter the number which you waant to find the factorial of it: '))
c = 1
d = 2
for a in range(z-1):
b = c * d
c = b
d +=1
if z <= 1:
print(c)
else:
print(b)

ElyasSAhmad
Автор

factorial of a number

def fact(n):
x=n
for i in range(1, n):
x*=(n-i)
return x

result=fact(5)
print(result)

rameshbanoth
Автор

def fac(n):
a=[ ]
for i in range(1, n+1):
a.append(i)
import numpy
c=numpy.prod(a)
Print (c)

_a.j_a.y
Автор

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

n = int (input())
res = multiply (n)
print (res)

mr.KrishnaTalks.
Автор

def fib(n):
if n < 0:
print("Must be a number above zero! ")

a = 0
b = 1

if n == 1:
print(a)

elif n > 1:
print(a)
print(b)

for i in range(2, n):

c = a + b
a = b
b = c
print(c)

fib(-2)

MacroNinja
Автор

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)

hozaifashakeel
Автор

you can also do :
def factorial(n):
if n == 0:
return 1
else:
recurse = factorial(n-1)
result = n * recurse
return result

Maxmikemusic