Chessboard using python - turtle programming

Publié le: 23 July 2021
sur la chaîne: Adi's Technical Aid
10
1

Code :
import turtle

t = turtle.Turtle()
t.speed(10)


t.penup()
t.left(180)
t.forward(160)
t.left(90)
t.forward(160)
t.left(90)
t.pendown()


x = -160
y = -120


fill_color = "black"


for i in range(8):
for j in range(8):
t.begin_fill()
for k in range(4):
t.forward(40)
t.left(90)

t.fillcolor(fill_color)
t.end_fill()

if fill_color == "black":
fill_color = "white"
elif fill_color == "white":
fill_color = "black"

t.forward(40)

t.penup()
t.goto(x, y)
t.pendown()
y = y + 40

setting the initial block color for the next row
if fill_color == "black":
fill_color = "white"
elif fill_color == "white":
fill_color = "black"

turtle.done()


Sur cette page du site, vous pouvez voir la vidéo en ligne Chessboard using python - turtle programming durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Adi's Technical Aid 23 July 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 10 fois et il a aimé 1 téléspectateurs. Bon visionnage!