Day042.绘制9个同心圆

输出如下

代码如下

'''
    绘制9个同心圆
    @Ref 2017.Python语言程序设计基础.第2版.嵩天, p55
    @Version: v0.1, Python 3.9.5, Notus(hehe_xiao@qq.com), 2021.06.18
    @Updated: 2021.06.18
'''

from turtle import *

def drawConcentricCircles():
    color("red")
    x, y = 0, 0                         # 圆心

    for i in range(9):
        radius = (i + 1) * 20           # 半径
        penup()
        goto(x, y - radius)
        pendown()
        circle(radius, 360)

    done()

drawConcentricCircles()
原文地址:https://www.cnblogs.com/leo1875/p/14897931.html