使用 # 号输出一个长方形,用户可以指定宽和高

height = int(input("please input height: "))
width = int(input("please input width: "))

while height > 0:
tmp = width
while tmp > 0:
print("#", end="")
tmp -= 1
print()
height -= 1

测试结果: 

Python 练习:使用 # 号输出长方形

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
猜你喜欢
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
相关资源
相似解决方案