course_de_tortue.py

Created by elodie-gamot

Created on October 05, 2021

309 Bytes

On imagine une course de tortue. Chaque tortue incarne une division : par 3, par 4, par 5 et par 7. Le top départ est donné par un nombre : seules les tortues qui sont des diviseurs de ce nombre peuvent avancer. Elles avancent d’un nombre de pas égal au quotient de la division.


from math import *
from turtle import *

div=[3,4,5,7]
col=['red','blue','green','orange']
pos=[0,0,0,0]

penup()

def sprint(n):
  penup()
  for i in range(4):
    color(col[i])
    nb=div[i]
    goto(-160,-i*20)
    if n%nb==0:
      pendown()
      forward(n)
    penup()

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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.