1 #conding=utf-8 2 import sys 3 def fun(char,num): 4 """ 5 @author:成都-杰森 QQ:917207011 6 :param char:str(char) 7 :param num:int(num) 8 :return: 9 char = str(char) 10 num = int(num) 11 rowLen = num 12 for i in range(num): 13 output = ‘ ‘ * (rowLen - i) + char 14 for k in range(i): 15 output += ‘ ‘ * rowLen + char 16 print(output) 17 num -= 1 18 for i in range(num): 19 output = ‘ ‘ * (i + 2) + char 20 for k in range(num - i - 1): 21 output += ‘ ‘ * rowLen + char 22 print(output) 23 if __name__ == ‘__main__‘: 24 fun("$$$$$$",6)
运行结果:
原文地址:https://www.cnblogs.com/jason89/p/9185422.html
时间: 2024-11-12 02:27:40