1. 首页
  2. 编程面试题
  3. Python
  4. Python基础

用Python编写程序以生成星形三角形。




def pyfunc(r):
    for x in range(r):
        print(' '*(r-x-1)+'*'*(2*x+1))    
pyfunc(9)

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

发布者:admin,如若转载,请注明出处:https://ai1024.vip/36426.html

QR code
//