首页 > 编程语言 > 详细

python

时间:2020-03-14 11:20:56      阅读:52      评论:0      收藏:0      [点我收藏+]

1.五角星

import turtle        
turtle.fillcolor("red")            
turtle.begin_fill()             
count = 1                        
while count <= 5:               
    turtle.forward(100)             
    turtle.right(144)             
    count += 1                  
turtle.end_fill()

技术分享图片

 

 

2.六角形

import turtle 
turtle.pensize(2)
turtle.fillcolor("white")
turtle.begin_fill()
turtle.right(330)
turtle.forward(200)
for i in range(2):
    turtle.right(120)
    turtle.forward(300)
turtle.right(120)    
turtle.forward(100)
turtle.right(300)
turtle.forward(100)
for i in range(3):
    turtle.right(120)
    turtle.forward(300)
turtle.end_fill()
turtle.hideturtle()
turtle.done()

技术分享图片

 

 3.叠加等边三角形

import turtle 
turtle.pensize(2)
turtle.fillcolor("white")
turtle.begin_fill()
for i in range(3):
    turtle.forward(100)
    turtle.right(120)
turtle.right(300)
turtle.forward(100)
for i in range(3):
    turtle.right(120)
    turtle.forward(200)
turtle.end_fill()
turtle.hideturtle()
turtle.done()

技术分享图片

 

python

原文:https://www.cnblogs.com/cjl1124/p/12490548.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!