trigo.py

Created by jilsaint90

Created on January 03, 2021

1.15 KB

trace un cercle trigonométrique grâce au module turtle, mais n’a malheureusement pas une précision folle, au vu de la taille réduite de l’écran de la calculatrice (rend mieux sur éditeur de l’ordi, comme thonny)

```from math import*
from turtle import*

speed(10)
hideturtle()

width(2)
up()
goto(0,-90)
down()
circle(90)

liste_angl=(0,30,45,60,90,120,135,150,180,210,225,240,270,300,315,330)
liste_str=("0 2π","π/6","π/4","π/3","π/2","2π/3","3π/4","5π/6","π -π","7π/6","5π/4","4π/3","3π/2","5π/3","7π/4","11π/6")

x=0
width(1)
color("grey")
down()

while x<=15:

goto(0,0)
forward(90)
x=x+1

y=0
x=0
color("black")
up()

while x<=4:
y=-2
goto(0,0)
forward(90+y)
write((liste_str[x]))
x=x+1

while 4<x<8:
y=17
goto(0,0)
forward(90+y)
write((liste_str[x]))
x=x+1

while 8<=x<=12:
y=23
goto(0,0)
if x==8:
y=y+13
forward(90+y)
write((liste_str[x]))
x=x+1

while 12<x<=15:
y=14
goto(0,0)
forward(90+y)
write((liste_str[x]))
x=x+1

up()
goto(0,0)
down()
write("0")

up()
goto(22,42)
down()
write("x")

up()
goto(22,-42)
down()
write("-x")

up()
goto(-42,42)
down()
write("x-π")

up()
goto(-42,-42)
down()
write("π-x")```