python -----------梯形

梯形:
[root@python py]# vim  tx.py 

#!/usr/bin/env python3

line = int(input("请输入梯形底边的整数: "))
shang = int(input("请输入梯形上边的整数: "))

for i in range(shang,line+1):
    for k in range(line-i):
        print(" ",end="")
    for j in range(i*2-1):
        print("*",end="")
    print("")


[root@python py]# python tx.py 
请输入梯形底边的整数: 10
请输入梯形上边的整数: 4
      *******
     *********
    ***********
   *************
  ***************
 *****************
*******************

猜你喜欢

转载自www.cnblogs.com/qcdf/p/10040250.html