graphique_fonction_turtle.py

Created by elodie-gamot

Created on October 11, 2021

519 Bytes

Tracer une fonction avec Turtle


from turtle import *
from math import *

def droite_graduee():
  x=-160
  goto(x,0)
  pendown()
  while x<160:
    setheading(0)
    forward(10)
    left(90)
    forward(3)
    backward(3)
    x+=10
  penup()
  y=-110
  goto(0,y)
  pendown()
  while y<110:
    setheading(90)
    forward(10)
    right(90)
    forward(3)
    backward(3)
    y+=10

def f(x):
  return 5*sqrt(x)-3
  
def graphique():
  droite_graduee()
  penup()
  for x in range(0,150,10):
    goto(x,f(x))
    pendown()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.