Python输出特殊字符图形大雁南飞
Posted jason89
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python输出特殊字符图形大雁南飞相关的知识,希望对你有一定的参考价值。
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)
运行结果: