0% found this document useful (0 votes)
5 views1 page

Python Turtle Shape Example Code

The document provides a code snippet for a turtle graphics program that prompts the user for the number of sides or circles and the type of shape to draw. If the user selects 'r', it draws a circle; otherwise, it draws a polygon by moving forward and turning left based on the number of sides. The example illustrates basic user input handling and shape drawing using the turtle module.

Uploaded by

gcseresources7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Python Turtle Shape Example Code

The document provides a code snippet for a turtle graphics program that prompts the user for the number of sides or circles and the type of shape to draw. If the user selects 'r', it draws a circle; otherwise, it draws a polygon by moving forward and turning left based on the number of sides. The example illustrates basic user input handling and shape drawing using the turtle module.

Uploaded by

gcseresources7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

[Link] example(number = int(turtle.

numinput("Number of sides or circles",


"How many sides or circles in your shape?", 6))
shape = [Link]("Which shape do you want?",
"Enter 'p' for polygon or 'r' for rosette:") )
-----

[Link] shape == 'r':


[Link](100)
else:
[Link] (150)
[Link](360/number)
This is an example.

You might also like