Python 试图通过让用户输入列数和行数来打印文本,我哪里出错了?
当我做3乘3的时候,它会给我一张由1、4、4、3张笑脸组成的列表 有些打印不正确Python 试图通过让用户输入列数和行数来打印文本,我哪里出错了?,python,Python,当我做3乘3的时候,它会给我一张由1、4、4、3张笑脸组成的列表 有些打印不正确 print ("number of rows") rows = int(input()) print ("number of columns") col = int(input()) for noofrows in range(0,rows,1): print(":)") for noofcol in range(0,col,1): print(":)",end="") :) :):
print ("number of rows")
rows = int(input())
print ("number of columns")
col = int(input())
for noofrows in range(0,rows,1):
print(":)")
for noofcol in range(0,col,1):
print(":)",end="")
:)
:):):):)
:):):):)
:):):)
this is the output i get
Python 2中的等效代码,行为3,列为3输出
:::
: : :
:::
什么你能更好地展示我们的输出吗?你能在你的帖子中加入样本输出吗?你有问题吗?我在这里看到的是代码,它能精确地生成您所说的输出。
for noofrows in range(rows): #same as range(0,row,1)
#don't print a smiley here
#print(":)")
for noofcol in range(col): #same as range(0,col,1)
print(":)",end="")
#print an empty string instead and at the end of the loop
print("")