Batman's Python Code
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Welcome!
This Python template lets you get started quickly with a simple one-page playground.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# A recursive function to find nth catalan number
def catalan(n):
# Base Case
if n <= 1:
return 1
# Catalan(n) is the sum of catalan(i)*catalan(n-i-1)
res = 0
for i in range(n):
res +=
#finish the missing code in the line above
return res
# Driver Program to test above function
for i in range(15):
print(catalan(i), end=' ')
Press desired key combination and then press ENTER.
Advanced usage
If you want a more complex example (external libraries, viewers...), use the Advanced Python template
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content