human
Difference between Recursion and Iteration | -- -- - Recursion -- -- - method to find factorial of given number.
recursion call.
-- -- - Iteration -- -- - Method to find the factorial of a given number.
using iteration.
Driver method"
How can the above be solved in Python?
 Can you provide a code to difference between Recursion and Iteration and the other steps required?
assistant
#Here is code to difference between Recursion and Iteration and the other steps required.
 def factorialUsingRecursion ( n ) :
	if ( n == 0 ) :
		return 1 ;
	return n * factorialUsingRecursion ( n - 1 ) ;
def factorialUsingIteration ( n ) :
	res = 1 ;
	for i in range ( 2 , n + 1 ) :
		res *= i ;
	return res ;
num = 5 ;
print ( " Factorial ▁ of " , num , " using ▁ Recursion ▁ is : " , factorialUsingRecursion ( 5 ) ) ;
print ( " Factorial ▁ of " , num , " using ▁ Iteration ▁ is : " , factorialUsingIteration ( 5 ) ) ;