从键盘输入半径、绘制同心圆的个数及画笔的颜色
1 import turtle 2 3 turtle.pensize(10) 4 5 r=eval(input()) 6 n=eval(input()) 7 color=input() 8 turtle.pencolor(color) 9 10 for i in range(n): 11 turtle.circle(r+(i-1)*20,360)#每个同心圆的半径差为20 12 turtle.penup() 13 turtle.right(90) 14 turtle.forward(20) 15 turtle.left(90) 16 turtle.pendown()
键盘输入:
20
4
red