# Print the lower left triangle: for i in range(10): After that, range(0,i)
# Print the upper right triangle: On the basis of the lower left corner, change "-" into " "space
for i in range(10): for j in range(0,i): print("-",end=" ") for j in range(i,10): print("$", end=" ") print("") print("-------------------------")
# Print the upper left triangle: for i in range(10): After that, range(0,10-i)
# Print the lower right triangle: On the basis of the upper left corner, change "-" into " "space
for i in range(10): for j in range(0, 10 - i): print("-", end=" ") for k in range(10 - i, 10): print("$", end=" ") print("")
# To print the upper triangle, just remove the "-"
for i in range(10): for j in range(0, 10 - i): print(end=" ") for k in range(10 - i, 10): print("$", end=" ") print("")
# To print an inverted triangle, just remove the "-"
for i in range(10): for j in range(0,i): print(end=" ") for j in range(i,10): print("$", end=" ") print("")