Im trying to figure out why my squars wont fill with the color black when using turtle library

Viewed 24

Im trying to fill some squars with the color black, but it wont fill

my code:

from turtle import *
setup(1920,1080,0,0)
k=Turtle()
k.right(45)
størrelse=40
n=int(input("Hvor mange diamanter?  "))
for i in range(n+1):
    color("black")
    if i!=0:
        if i%2!=0:
            begin_fill()
            for c in range(4):
                    k.forward(i*størrelse)
                    k.right(90)
            end_fill()
        else:
            for c in range(4):
                    k.forward(i*størrelse)
                    k.right(90)
    k.penup()
    k.left(90)
    k.forward(størrelse/2)
    k.left(90)
    k.forward(størrelse/2)
    k.left(180)
    k.pendown()

done()

If i use this code i only get squars, but they are not filled any solutions?

1 Answers

forgot "k." infront of fill and end function

Related