Python学习(7)---3月24日打卡

1、

2、

"""
功能:五角星的绘制
"""
import turtle
def draw_pentagram(size):
    """
    绘制五角星(使得结构简洁,程序化)
    :param size:
    :return:
    """
    count = 1
    while count <= 5:
        turtle.forward(size)
        turtle.right(144)
        # count = count + 1
        count+=1
def main():
    """
    主函数
    """
    # 计数器
    size=50
    while size<=500:
        # 调用函数
        draw_pentagram(size)
        # size=size+50
        size+=50
    turtle.exitonclick()
if __name__=='__main__':
    main()

猜你喜欢

转载自blog.csdn.net/weixin_42246997/article/details/88779213