1. Turtle code to draw Apple logo.
from turtle import *
width(10)
begin_fill()
left(160)
circle(100, 100)
circle(200, 60)
circle(40, 90)
circle(-40, 100)
circle(40, 100)
circle(200, 30)
left(90)
circle(-70, 150)
left(120)
circle(160, 55)
end_fill()
right(110)
up()
forward(25)
down()
begin_fill()
circle(-110, 90)
right(90)
circle(-110, 90)
end_fill()
done()
2. Prog to Make a small & colourfull design.
from turtle import *
import colorsys
speed(0)
bgcolor("black")
h = 0
for i in range(16):
for j in range(18):
c = colorsys.hsv_to_rgb(h, 1, 1)
color(c)
h += 0.005
rt(90)
circle(150 - j * 6, 90)
lt(90)
circle(150 - j * 6, 90)
rt(180)
circle(40, 24)
done()
3. Big Rangoli
from turtle import *
import colorsys
bgcolor ('black')
tracer (500)
def draw():
h = 0
for i in range(100):
c = colorsys.hsv_to_rgb(h,1,1)
h += 0.5
up()
goto(0,0)
down()
color('white')
fillcolor(c)
begin_fill()
rt(98)
circle(i,12)
fd(i)
lt(29)
for j in range(129):
fd(i)
circle(j,299,steps=2)
end_fill()
draw()
done()
Post a Comment
0Comments