Skip to content

Commit 3a9d2bf

Browse files
Create pattern_01_01n.py
1 parent 1fc36ec commit 3a9d2bf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

function/recursion/pattern_01_01n.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def f(n):
2+
if n==0:
3+
return
4+
def g(t):
5+
if t==0:
6+
return
7+
g(t-1)
8+
print(t,end=' ')
9+
g(n)
10+
print()
11+
f(n-1)
12+
n=int(input('enter a number: '))
13+
f(n)
14+
'''
15+
output:
16+
enter a number: 6
17+
1 2 3 4 5 6
18+
1 2 3 4 5
19+
1 2 3 4
20+
1 2 3
21+
1 2
22+
1
23+
'''

0 commit comments

Comments
 (0)