python ----打印一个四边形

时间:2019-03-18 00:05:55   收藏:0   阅读:323

1、方法一

n = input();
print("*"*n)
for i in range(n-2)
    print("*", *(n-2),"*")
print("*"*n)

2、方法二

n=5
e = -n//2
for i in range(e,n+e):
    if i ==e or i==n+e-1:
        print(x*n)
    else:
        print(x+ *(n-2)+x)

 

原文:https://www.cnblogs.com/yaradish/p/10549789.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!