Last active
December 10, 2015 08:19
-
-
Save titouanc/4407229 to your computer and use it in GitHub Desktop.
INFO-F-101: Exercices
Chapitre4: TurtleWorld
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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