Introduction to Programming using Python 1st Edition

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

Chapter 3 - Mathematical Functions, Strings, and Objects - Programming Exercises - Page 88: 3.15

Answer

import turtle turtle.circle(100) # face # smile turtle.penup() turtle.left(90) turtle.forward(30) turtle.right(60) turtle.pendown() turtle.forward(80) turtle.backward(80) turtle.left(120) turtle.forward(80) turtle.backward(80) # nose turtle.penup() turtle.setheading(90) turtle.forward(110) turtle.pendown() turtle.right(145) turtle.forward(80) turtle.backward(80) turtle.right(70) turtle.forward(80) turtle.backward(80) # right eye turtle.penup() turtle.setheading(0) turtle.forward(40) turtle.setheading(90) turtle.forward(20) turtle.pendown() turtle.dot(35) # left eye turtle.penup() turtle.setheading(180) turtle.forward(80) turtle.pendown() turtle.dot(35) turtle.done()

Work Step by Step

# (Turtle: paint a smiley face) Write a program that paints a smiley face, as shown in # Figure 3.6a. import turtle turtle.circle(100) # face # smile turtle.penup() turtle.left(90) turtle.forward(30) turtle.right(60) turtle.pendown() turtle.forward(80) turtle.backward(80) turtle.left(120) turtle.forward(80) turtle.backward(80) # nose turtle.penup() turtle.setheading(90) turtle.forward(110) turtle.pendown() turtle.right(145) turtle.forward(80) turtle.backward(80) turtle.right(70) turtle.forward(80) turtle.backward(80) # right eye turtle.penup() turtle.setheading(0) turtle.forward(40) turtle.setheading(90) turtle.forward(20) turtle.pendown() turtle.dot(35) # left eye turtle.penup() turtle.setheading(180) turtle.forward(80) turtle.pendown() turtle.dot(35) 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.