Python Basic - 练习-提示用户输入长度跟宽度,然后输出字符“0”描述出一个正方形

jacktangj 2020-04-19

[ python-script]# cat square.py

#!/usr/local/bin/python3
#date   : 2020.04.19
#author : feihuang

line=int(input("line number:"))
column=int(input("column number:"))

printline = 1
while printline <= line:
        printcolumn = 1
        while printcolumn <= column:
                print("#",end=(" "))
                printcolumn += 1
        print()
        printline += 1


#================================以下为实验输出==========================
"""
[ python-script]# ./square.py 
line number:10
column number:10
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
# # # # # # # # # # 
[ python-script]# ./square.py 
line number:20
column number:20
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
# # # # # # # # # # # # # # # # # # # # 
"""

相关推荐

码农的小得小感 / 0评论 2019-11-01