python-----矩形邊框


矩形邊框:
[root@python py]# vim  biankuan.py 

#!/usr/bin/env python3

line = int(input("請輸入一個數字: "))
for i in range(line):
    if i == 0 or i == line-1:
        for j in range(line):
            print("*",end="")
    else:
        for j in range(line):
            if j == 0 or j == line-1:
                print("*",end="")
            else:
                print(" ",end="")
    print("")
~               

[root@python py]# python biankuan.py 
請輸入一個數字: 10
**********
*        *
*        *
*        *
*        *
*        *
*        *
*        *
*        *
**********

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM