Affiche le nombre écrit à la manière des cisterciens.
from turtle import * def cistercien(n): if n<0 or n>9999: raise ValueError("0<=n<=9999 ?") points={ "A":(-50,75),"B":(0,75),"C":(50,75), "D":(-50,25),"E":(0,25),"F":(50,25), "G":(-50,-25),"H":(0,-25),"I":(50,-25), "J":(-50,-75),"K":(0,-75),"L":(50,-75)} chiffres=["B","BC","EF","BF","EC", "BCE","CF","BCF","CFE","BCFE"] ordre=[ {"B":"B","C":"C","E":"E","F":"F"}, {"B":"B","C":"A","E":"E","F":"D"}, {"B":"K","C":"L","E":"H","F":"I"}, {"B":"K","C":"J","E":"H","F":"G"}] reset() hideturtle() penup() goto(*points["K"]) pendown() goto(*points["B"]) for i in range(4): n,r=divmod(n,10) penup() goto(*points[ordre[i][chiffres[r][0]]]) pendown() for c in chiffres[r][1:]: goto(*points[ordre[i][c]]) penup() goto(0,0)