from turtle import * from math import pi, sin, cos def co(angle) : return cos(angle * pi / 180) def si(angle) : return sin(angle * pi / 180) def penrose(n): pensize(2) penup() delta = 360 / n alpha, beta = 180 - delta, delta / 2 a, b = 70 * si(2 * beta), 10 goto(-a / 2, 110 - a) pendown() for _ in range(n): for (t,r) in ((360-delta,b),(delta,a+2*b+2*b*co(alpha)), (delta,a+2*b+4*b*co(alpha)),(beta,2*b*si(alpha/2)), (180-beta,a+2*b+2*b*co(alpha)),(360-delta,a+b), (180,a),(delta,0)): rt(t);fd(r) n = int(input('Nb cotes ? ')) penrose(n) hideturtle()