Batman's Python Code
matthiaslum
2,744 views
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=' ')
Advanced usage
If you want a more complex example (external libraries, viewers...), use the Advanced Python template
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.