摘要:
键盘就收数字n ,输出2*n+1行的菱形如:n=2打印为: * *** *代码为: 1 def printUpTriangle(x,y): 2 print(" "*(y+1-x)+"*"*(2*x-1)+" "*(y+1-x)) 3 4 def printDownTriangle(x,y): 5 print(" "*(x-y-1)+"*"*(2*((2*y+1)-x)+1)+" "*(x-y-1)) 6 7 8 n = int(raw_input("please i 阅读全文