1
Hello, I’m trying to make this code work as follows: you say the width and height and then it completes with the proper "#" and then it would ask again and continue like this until the person closes the program.
However, a small error occurs when finishing the "#" drawing. It occurs that there is one more # between the shown figure and the next question. I took a test and found out that if I take the "=" of line 9 em coluna<=altura
the error stops existing but the question that should be asked next does not occur. would someone please explain to me?
def retangulo(x,y):
linha=1
coluna=1
while coluna<=altura:#4
while linha<=largura:#3
print("#",end=" ")
linha = linha +1
if coluna<=altura:
print()
linha=2
print("#",end=" ")
coluna = coluna + 1
largura = int(input("coloque a largura: "))
altura = int(input("Coloque a altura: "))
while largura>0 or altura>0:
if retangulo(largura,altura):
print(retangulo(largura,altura))
print()
print()
largura = int(input("coloque a largura: "))
altura = int(input("Coloque a altura: "))
This answers your question? Draw square on canvas using wire fences (#)
– Gabriel Oliveira