画一组同切圆
输入
import turtle turtle.color(‘red‘) turtle.circle(30) turtle.circle(60) turtle.circle(90) turtle.circle(120) turtle.circle(150) turtle.circle(180) turtle.hideturtle()
输出
画一组同心圆
输入
import turtle turtle.pos() turtle.color(‘red‘) turtle.begin_fill() turtle.up() turtle.goto(0,-10) turtle.down() turtle.circle(10) turtle.color(‘orange‘) turtle.up() turtle.goto(0,-30) turtle.down() turtle.circle(30) turtle.color(‘yellow‘) turtle.up() turtle.goto(0,-60) turtle.down() turtle.circle(60) turtle.color(‘green‘) turtle.up() turtle.goto(0,-90) turtle.down() turtle.circle(90) turtle.color(‘blue‘) turtle.up() turtle.goto(0,-120) turtle.down() turtle.circle(120) turtle.color(‘purple‘) turtle.up() turtle.goto(0,-150) turtle.down() turtle.circle(150) turtle.color(‘pink‘) turtle.up() turtle.goto(0,-180) turtle.down() turtle.circle(180)
输出
画一个五角星
输入
import turtle turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.hideturtle()
输出
画一个黄色实心五角星
输入
import turtle turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.end_fill() turtle.hideturtle()
输出
画左上角的五颗五角星
import turtle turtle.bgcolor(‘red‘) turtle.speed(100) turtle.pos() turtle.up() turtle.goto(-400,200) turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.end_fill() turtle.down() turtle.up() turtle.goto(-270,320) turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.right(45) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.end_fill() turtle.down() turtle.up() turtle.goto(-200,210) turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.right(160) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.end_fill() turtle.down() turtle.up() turtle.goto(-190,130) turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.left(0) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.end_fill() turtle.down() turtle.up() turtle.goto(-250,60) turtle.color(‘yellow‘) turtle.fillcolor(‘yellow‘) turtle.begin_fill() turtle.right(20) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.forward(50) turtle.right(144) turtle.end_fill() turtle.down() turtle.hideturtle()
输出
时间: 2024-11-10 15:30:32