* Print using a triangle with Python.

Shaped like a triangle in the following figure. Ideas circulating

------*------
-----***-----
----*****----
---*******---
--*********--
-***********-
*************

. 1 Bian = int (INPUT ( " Please enter the side length of your triangle: " ))
 2 ceng =. 1
 . 3  the while ceng <= Bian:
 . 4      X = Bian - ceng
 . 5      Y = ceng * 2 -. 1
 . 6      Print ( '  ' + X * " * " * Y)
 . 7      ceng +. 1 =

 

Guess you like

Origin www.cnblogs.com/sdzycw/p/11670965.html