Skip to content

Instantly share code, notes, and snippets.

@titouanc
Last active December 10, 2015 08:19
Show Gist options
  • Select an option

  • Save titouanc/4407229 to your computer and use it in GitHub Desktop.

Select an option

Save titouanc/4407229 to your computer and use it in GitHub Desktop.
INFO-F-101: Exercices Chapitre4: TurtleWorld
from math import pi
from swampy.TurtleWorld import TurtleWorld, Turtle
def arc(turtle, r, angle=360):
"""Trace un arc de cercle de rayon r."""
l = 2*pi*r
for i in range(angle):
turtle.fd(l/360)
turtle.lt(1)
if __name__ == "__main__":
WORLD = TurtleWorld()
bob = Turtle(WORLD)
bob.set_delay(0)
r = int(input("rayon du cercle ? "))
a = int(input("Angle d'arc a tracer ? "))
arc(bob, r, a)
input("Tapez enter pour sortir")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment