n=int(input("Enter the no of row : ")) for r in range(1,n+1): for s in range(1,n-r+1): print(" ",end='') for c in range(1,r+1): print("*",end='') print()
Just change the "*" to the corresponding row number.
n=int(input("Enter the no of row : ")) for r in range(1,n+1): for s in range(1,n-r+1): print(" ",end='') for c in range(1,r+1): print(r,end='') print()
Just change the "*" to the corresponding column number.
n=int(input("Enter the no of row : ")) for r in range(1,n+1): for s in range(1,n-r+1): print(" ",end='') for c in range(1,r+1): print(c,end='') print()