使用 # 号输出一个长方形,用户可以指定宽和高
height = int(input("please input height: "))width = int(input("please input "))while height > 0: tmp = width while tmp > 0: print("#", end="") tmp -= 1 print() height -= 1
测试结果: