+ 1

What is Recursion in python with examples ?

7th Aug 2017, 7:05 AM
Keshav M
Keshav M - avatar
2 Answers
+ 6
recursion is if a function calls itself. Most famous example is probably calculating factorials: factorial(4) = 4*3*2*1 def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)
7th Aug 2017, 7:11 AM
Martin Ed
Martin Ed - avatar
+ 3
Great video good explaining recursion with a recursive implementation of Hanoi towers game: https://youtu.be/rVPuzFYlfYE
7th Aug 2017, 12:18 PM
visph
visph - avatar