while I was working on the Python practice, I found a question that I cannot solve by myself. 
The question is,

> 
> Input one integer(n), and then write the codes that make a triangle using 1 to 'n'. Use the following picture. You should make only one function, and call that function various times to solve the question. The following picture is the result that you should make in the codes.
>  Receive one integer as an argument, print the number from 1 to the integer received as a factor in a single line, and then print the line break character at the end. Once this function is called, only one line of output should be printed.
>  [![this is the following picture](https://i.stack.imgur.com/IE9A0.jpg)](https://i.stack.imgur.com/IE9A0.jpg)
> 
> 
> 

So by that question, I found that this is a question that requires the
recursion since I have to call your function only once.
I tried to work on the codes that I made many times, but I couldn't solve it.

```
global a
a = 1

def printLine(n):
 global a
 if (n == 0):
     return

 for i in range(1, a + 1):
 print(i, end=" ")
 print()
  a += 1

 for k in range(1, n+1):
     print(k, end=" ")
 print()

 printLine(n - 1)

 n = int(input())
 printLine(n)

```

Then I wrote some codes to solve this question, but the ascending and descending part is kept overlapping. :(
What I need to do is to break two ascending and descending parts separately in one function, but I really cannot find how can I do that. So which part should I have to put the recursive function call?
Or is there another way can divide the ascending and descending part in the function?
Any ideas, comments, or solutions are appreciated.
Thx