码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2020-04-19 12:32:24      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:inpu   col   ntc   usr   author   private   while   描述   ==   

[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”描述出一个正方形

标签:inpu   col   ntc   usr   author   private   while   描述   ==   

原文地址:https://www.cnblogs.com/fei-huang/p/12720522.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!