added docktest

pull/335/head
Vedant Gautam 2021-06-03 22:05:06 +05:30
parent bbef37eefb
commit 4a640b436b
1 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,16 @@ The first 10 terms of Catalan sequence are :
def catalan(n): def catalan(n):
"""
>>> catalan(2)
2
>>> catalan(5)
42
>>> catalan(-1)
Traceback (most recent call last):
...
IndexError: list assignment index out of range
"""
# Base Case # Base Case
if n == 0 or n == 1: if n == 0 or n == 1:
return 1 return 1