Python Basic - 练习-提示用户输入长度跟宽度,然后输出字符“0”描述出一个正方形
Posted FeiHuang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python Basic - 练习-提示用户输入长度跟宽度,然后输出字符“0”描述出一个正方形相关的知识,希望对你有一定的参考价值。
[root@Private 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
#================================以下为实验输出==========================
"""
[root@Private python-script]# ./square.py
line number:10
column number:10
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
[root@Private python-script]# ./square.py
line number:20
column number:20
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
"""
以上是关于Python Basic - 练习-提示用户输入长度跟宽度,然后输出字符“0”描述出一个正方形的主要内容,如果未能解决你的问题,请参考以下文章