Introduction to Programming using Python 1st Edition

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

Chapter 6 - Functions - Programming Exercises - Page 211: 6.39

Answer

code

Work Step by Step

# 6.39 (Turtle: draw a star) Write a program that draws a star, as shown in Figure 6.11b. # Use the drawLine function defined in Exercise 6.38. import turtle def drawLine(x1, y1, x2, y2, color="black", size=1): turtle.color(color) turtle.pensize(size) turtle.penup() turtle.goto(x1, y1) turtle.pendown() turtle.goto(x2, y2) def main(): drawLine(10, 50, 110, 50, "blue", 5) drawLine(110, 50, 20, 110, "blue", 5) drawLine(20, 110, 60, 20, "blue", 5) drawLine(60, 20, 100, 110, "blue", 5) drawLine(100, 110, 10, 50, "blue", 5) turtle.done() main()
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.