☀️
The sun
12 golden rays radiating from a bright center dot.
Sprout· ages 8–1015 minforward + backwardturtle.dotfor loops
sun.py
520×520
First load pulls ~10 MB of Python. Only happens once — the browser caches it after.
What should the output look like?
A sun in the middle of the canvas with rays going outward.
📖
How this works
For each ray, the turtle walks 90 steps forward, then walks 90 steps backward to return to the center. Then it turns and does it again. After 12 rays with a 30° turn between each, we've swept the full 360° circle.
Your turn — try these
- 1Give every other ray a different color — use `if i % 2 == 0:`.
- 2Make some rays longer than others by using `random.randint(60, 120)`.
- 3Add a smiley face on the sun (two dots for eyes, one for the mouth).