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!