Rookie problem. Problems in python3 while loop nesting print inverted triangle

1, print a triangle,
use while, to complete the output of the following graphics

*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

the code is as follows:

h=1
while h<=5:
    w=1
    while w<=h:
        print("x",end="")
        w+=1
    print("")
    h+=1
h=5
while h>=1:
    w=5
    while w>=h:
        print("x",end="")
        w-=1
    print("")    
    h-=1
x
xx
xxx
xxxx
xxxxx
x
xx
xxx
xxxx
xxxxx

but the result I printed is like this, I really don"t understand how to reduce line 6 by one X in turn
ask the master to answer! Thank you!

Mar.26,2021

def print_pic(num):
  print ''.join(['*'] * num)

i = 1
h = 5
while i <= (2 * h - 1):
  print_pic(i if i <= h else (2 * h - i))
  i = i + 1
i = 1
h = 5
while i <= (2 * h - 1):
  if i <= h:
    print ''.join(['*'] * i)
  else:
    print ''.join(['*'] * (2 * h - i))
  i = i + 1
-sharp 
def print_pic(num, index=1):
  count = index if index <= num else 2 * num - index
  print ''.join(['*'] * count)
  if index > 2 * num - 1:
    return
  print_pic(num, index=index+1)

print_pic(5)

< H1 > I am also Mengxin. Come on, encourage me < / H1 >

hog5
while h > = 1:

w=1
while h>w:
    print("x",end="")
    w+=1
print("")    
h-=1

I = 1
while I < = 5:

j = 1
while j <= i:
    print("x",end=" ")
    j += 1
print("")
i += 1
if i==6:
    i = 5
    while i>=1:
        j = 1
        while i>j:
            print("x",end=" ")
            j += 1
        print("")
        i -= 1
    break
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e542e5-43d6d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e542e5-43d6d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?