[Python] I put no arguments in the final line, but I get this error: "TypeError: draw() takes...

Discussão em 'Python' iniciado por Stack, Setembro 14, 2025.

  1. Stack

    Stack Membro Participativo

    I tried putting in all applicable arguments, leading to an error saying "thickness is not described"

    import turtle

    class Blocks:
    def __init__(self, color, thickness):
    self.color = color
    self.thickness = thickness
    turtle.color(self.color)
    turtle.width(self.thickness)

    def draw_square():
    for i in range(4):
    turtle.forward(100)
    turtle.right(90)

    def draw_legs():
    ang_lst1 = [45, 135, 225]
    ang_lst2 = [45, 315, 0]
    n = 0
    for i in range(3):
    turtle.forward(100)
    turtle.right(ang_lst1[n])
    turtle.forward(56)
    turtle.right(ang_lst2[n])
    n += 1

    def draw():
    for i in range(2):
    draw_square()
    turtle.goto(-40, 40)
    draw_legs()

    red_block = Blocks('red', 5)

    red_block.draw()

    Continue reading...

Compartilhe esta Página