Introduction to Programming using Python 1st Edition

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

Chapter 1 - Introduction to Computers, Programs, and Python - Programming Exercises - Page 29: 1.21

Answer

import turtle #clock turtle.pensize(3) turtle.forward(180) turtle.right(180) turtle.forward(180) turtle.pensize(2) turtle.right(90) turtle.forward(200) turtle.right(180) turtle.forward(200) turtle.pensize(4) turtle.right(195/2) turtle.forward(140) turtle.right(180) turtle.forward(140) turtle.left(90/12) turtle.penup() turtle.forward(240) turtle.left(90) turtle.pendown() turtle.pensize(3) turtle.circle(240) #add numbers to clock face turtle.penup() turtle.goto(220, -15) turtle.write(3, align="center", font=("Arial", 20, "normal")) turtle.goto(0,205) turtle.write(12, align="center", font=("Arial", 20, "normal")) turtle.goto(-220, -15) turtle.write(9, align="center", font=("Arial", 20, "normal")) turtle.goto(0, -235) turtle.write(6, align="center", font=("Arial", 20, "normal")) #display time turtle.goto(0, -150) turtle.write("9:15:00", align="center", font=("Arial", 15, "normal")) turtle.done

Work Step by Step

This exercise ties together everything this chapter has taught us about the turtle module. The code here creates a clock that is somewhat more realistic looking than the one in the book.
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.