Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 169: 5.55

Answer

code

Work Step by Step

# 5.55 (Turtle: chessboard) Write a program to draw a chessboard, as shown in # Figure 5.6b. import turtle turtle.speed(0) turtle.penup() turtle.goto(-150, 120) turtle.left(45) turtle.pendown() black = False for i in range(1, 9): for j in range(1, 9): turtle.begin_fill() turtle.circle(30, steps=4) if black: turtle.color("black") black = not black else: turtle.color("white") black = not black turtle.end_fill() turtle.penup() turtle.goto(turtle.xcor() + 42, turtle.ycor()) turtle.pendown() turtle.penup() turtle.goto(-150, turtle.ycor() - 42) turtle.pendown() black = not black turtle.penup() turtle.left(180) turtle.goto(-192, 161) turtle.color("gray") turtle.pensize(6) turtle.pendown() turtle.circle(240, steps=4) turtle.done()
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.