0
t = turtle.Pen()
t.left(90)
for x in range(180):
    t.forward(1)
    t.right(1)
    t.right(90)
    t.forward(115)

The pink eye that is slanted and curved at the sides and the bottom:

screenshot of panda icon

martineau
  • 119,623
  • 25
  • 170
  • 301
Anusya
  • 1
  • 1
  • Maybe Bezier curves? [How to get the points of a bezier curve/parabola using 3 unique points on a graph](https://stackoverflow.com/questions/56737686/how-to-get-the-points-of-a-bezier-curve-parabola-using-3-unique-points-on-a-grap) or https://github.com/LQR471814/Curve-Tortoise – ggorlen Aug 05 '22 at 02:42

1 Answers1

0

Be a turtle.

Go find a floor with square tiles. Place a penny on an intersection, or use some convenient pillar or corner -- that's the origin!

Now take tiny steps and change heading same as the program says, to see where you end up.

You wrote:

for x in range(180):
    t.forward(1)
    t.right(1)
    t.right(90)
    t.forward(115)

This corresponds to taking baby steps and shifting where you point ever so slightly with each one.

But look at that 90° turn! Too much. Followed by a giant step of 115 px. I think this is what you meant instead:

for x in range(180):
    t.forward(1)
    t.right(1)
t.right(90)
t.forward(115)

That is to say, let's draw an arc with total circumference of 180 units, with curvature totaling 180°. And then, outside the loop, after it has completed, let's hang a sharp rightie and take one giant step forward.

This is python. Indent matters. A lot.

J_H
  • 17,926
  • 4
  • 24
  • 44
  • Thank you! Now it has become a proper semi circle...but I still don't know how to make it curve to make it look like the panda eye :/ – Anusya Aug 05 '22 at 00:26
  • Currently you have a giant circle with large radius and a pair of pointy ends. To smooth them off, you will want to insert small circles where we turn more than one degree with each baby step. And then a straight line joining both of them would be fine for now. – J_H Aug 05 '22 at 18:31