What is wrong here?

The problem is to follow this pattern, for input 1<=n<10:
Input:7
Output:
1******
12*****
123****
1234***
12345**
123456*
1234567

and this is my code:

a=[]

n=int(input('Enter a number between 1 and 9 inclusive: '))

if n>9 or n<1:
pass
else:
for i in range(1,n+1):
a.append(i)

a=str(a)
a=a[0:-1]
a=a[1:]
a=a.replace(", ","")
for j in range(1,n+1):
    print(a[0:j]+"*"*(n-j))

But it doesn’t work. What could be wrong with it?

Hello @Sahrid, we don’t need to write such type of statements

(input('Enter a number between 1 and 9 inclusive: ') 

Just take the normal input num and then print the pattern, as shown in the example.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.