Python Studio ยท project 2 of 18 ยท premium, free for now
Any shape with one number
Draw a regular polygon using the variable sides: the turtle should turn 360 / sides degrees each time. Try changing sides to see other shapes.
Learn
Turn a corner and you turn part of a full circle (360 degrees). A shape with 5 sides turns 360 รท 5 = 72 degrees at each corner, a hexagon turns 60. So one variable, sides, can control the whole shape.
Your task
Draw a regular polygon using the variable sides: the turtle should turn 360 / sides degrees each time. Try changing sides to see other shapes.
Stretch challenge
Draw a pentagon, a hexagon and an octagon one after another, each in a different colour.
Press Run to see what your program prints.
More in this module
Keep going in Python Studio
Your first drawing: a square
Use a for loop to draw a square with sides of 100.
Start โ3A colour spiral
Draw a spiral of 72 lines that cycles through the six colours in the list: use pencolor, forward(i * 3) and left(59).
Start โ4A rosette of circles
Draw 12 circles of radius 60, turning left 30 degrees after each, and change the pen colour to a different colour for each pair.
Start โPractise the idea
๐ Play Bug Hunter
A Python program prints the wrong answer. Find the one line with the bug, then see the fix and why it was wrong.
FAQ
Any shape with one number: common questions
I am stuck. What can I do?
Press Hint for a nudge, read the message next to each goal, and compare your code with the lesson text. If you still need it, Show answer reveals a model solution. Try to type it yourself rather than copy it.
Does my work get saved?
Your ticks and XP are saved in this browser, and in your account if you log in. The code you type is not stored on a server.
Start a conversation
Enjoying coding? Meet a teacher.
Tell us the learner's age, country and what they would like to build, and we will suggest a class. A parent or guardian can make the enquiry.
- Tell us the learnerโs age or grade and goals
- Weโll suggest a suitable class or learning path
- Weโll confirm format, timing and fees with a parent or guardian
Play it, don't just read it
Write some code right now
Free games that need no sign-up. Pick one and play for five minutes.
Pick a game
- Code BuilderThe lines of a Python program are mixed up. Tap them into the rightโฆPlay
- Predict the OutputRead a short Python program and choose what it prints. Then watch it runโฆPlay
- Bug HunterA Python program prints the wrong answer. Find the one line with theโฆPlay
- Python For Loops and range()Change start, stop and step to see which numbers a loop uses.Play