Linguagem de programação Python primeira semana de funcionamento

1, estrela de cinco pontas desenhada

importação tartaruga como t 
t.setup ( 650350, -180, -180 ) 
t.fillcolor ( " vermelho " ) 
t.begin_fill () 
para i na gama (5 ): 
    t.fd ( 150 ) 
    t.right ( 145 ) 
t .end_fill ()

 2, desenho hexagonal

importação tartaruga como t 
t.setup ( 650350, -150,30 ) 
t.left ( 90 )
 para i na faixa (3 ): 
     t.fd ( 50 ) 
     t.right ( 120 ) 
     t.fd ( 100 ) 
t.seth ( 30 )
 para i na faixa (3 ): 
     t.fd ( 100 ) 
     t.right ( 120 ) 
     t.fd ( 50)

 

3, sobreposta triângulo equilátero desenhada

importação tartaruga como t 
t.setup ( 650350, -50,20 )
 para i na faixa (3 ): 
    t.fd ( 50 ) 
    t.right ( 120 ) 
t.seth ( 60 )
 para i na faixa (3 ): 
    t .FD ( 50 ) 
    t.right ( 120 ) 
    t.fd ( 50)

Acho que você gosta

Origin www.cnblogs.com/Mindf/p/12464017.html
Recomendado
Clasificación