Apprendre Python sur une Numworks
from turtle import * from random import * speed(0) # Un arbre def tree(d, s, c): color(c) if d <= 0: return forward(s) tree(d-1, s*.8, c) right(120) tree(d-3, s*.5, c) right(120) tree(d-3, s*.5, c) right(120) backward(s) # 11 rangees de 20 arbres for i in range(11): for j in range(20): # sapin debout ? setheading(90 if random()<.95 else 0) penup() # position depart goto(randint(-150,150),100-20*i+randint(-10,10)) pendown() # choix du vert c = choice([(0,120,0), (0,180,0)]) tree(10,randint(2,2+i),c)