Recursion in Python
Ajay Vikhram S M
1 min read
What is Recursion?
It's a type of program where you get a subroutine to call itself. Recursion Helps to Solve problems more humanly, some mathematical problems can be better solved using recursion.
A Small Example:
def reverse(value):
if value <= 0:
print("Done!")
return
else:
for i in range(value):
print("๐ก", end = "")
print()
reverse(value - 2)
reverse(10)
Output:
๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก
๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก
๐ก๐ก๐ก๐ก๐ก๐ก
๐ก๐ก๐ก๐ก
๐ก๐ก
Today is 57 / 100 days in my Python Journey, Please feel free to join here : https://join.replit.com/python
See You Tomorrow...
0
Subscribe to my newsletter
Read articles from Ajay Vikhram S M directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ajay Vikhram S M
Ajay Vikhram S M
I am a Tech enthusiast interested to learn new things from everyone and post my learning in public.