Introduction to Programming using Python 1st Edition

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

Chapter 2 - Elementary Programming - Programming Exercises - Page 61: 2.26

Answer

import turtle centerX, centerY, rad = eval(input("Enter centerX, centerY, radius: ")) turtle.penup() turtle.goto(centerX, centerY - 0.5 * rad) turtle.pendown() turtle.circle(rad) turtle.penup() turtle.goto(centerX+20,centerY+20) area = 3.14 * rad ** 2 turtle.write(area) turtle.done()

Work Step by Step

# (Turtle: draw a circle) Write a program that prompts the user to enter the # center and radius of a circle, and then displays the circle and its area, as shown # in Figure 2.5. import turtle centerX, centerY, rad = eval(input("Enter centerX, centerY, radius: ")) turtle.penup() turtle.goto(centerX, centerY - 0.5 * rad) turtle.pendown() turtle.circle(rad) turtle.penup() turtle.goto(centerX+20,centerY+20) area = 3.14 * rad ** 2 turtle.write(area) 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.