def factorial(x):
"""This is a recursive function
to find the factorial of an integer"""
if x == 1:
return 1
else:
return (x * factorial(x-1))
num = 1
print("The factorial of", num, "is", factorial(num))
import random
def guess(a,b):
x = random.randint(a,b)
return x
def check(x,y):
if y ** 2 == x:
return True
return False
x = 100
left, right = 0, x
y = guess(left, right)
while not check(x,y):
y = guess(left, right)
print(y)
pythonCopydef fact(n):
"""Recursive function to find factorial"""
if n == 1:
return 1
else:
return (n * fact(n - 1))
a = 6
print("Factorial of", a, "=", fact(a))
def factorial(x):
"""This is a recursive function
to find the factorial of an integer"""
if x == 1:
return 1
else:
return (x * factorial(x-1))
num = 1
print("The factorial of", num, "is", factorial(num))
import random
def guess(a,b):
x = random.randint(a,b)
return x
def check(x,y):
if y ** 2 == x:
return True
return False
x = 100
left, right = 0, x
y = guess(left, right)
while not check(x,y):
y = guess(left, right)
print(y)
pythonCopydef fact(n):
"""Recursive function to find factorial"""
if n == 1:
return 1
else:
return (n * fact(n - 1))
a = 6
print("Factorial of", a, "=", fact(a))