Орієнтовні розв'язки практичної роботи № 9 тренінгу Python
Завдання 1.1.
from turtle import *
from random import *
reset()
screensize(900,900)
pensize(3)
for i in range(12):
color(random(),random(),random())
for i in range(4):
fd(50)
lt(120)
rt(150)
from random import *
reset()
screensize(900,900)
pensize(3)
for i in range(12):
color(random(),random(),random())
for i in range(4):
fd(50)
lt(120)
rt(150)
Завдання 1.2.
from turtle import *
reset()
screensize(900,900)
pensize(3)
color('#f037ea', 'yellow')
for i in range(6):
begin_fill()
circle(50)
end_fill()
rt(60)
color('green','red')
up()
goto(0,-100)
down()
begin_fill()
circle(100,steps=6)
end_fill()
up()
goto(0,0)
down()
for i in range(6):
circle(50,steps=6)
rt(60)
shape('turtle')
shapesize(1,1,1)
color('black','red')
stamp()
up()
goto(0,-100)
down()
stamp()
for i in range(5):
lt(30)
up()
fd(100)
lt(30)
down()
stamp()
lt(60)
up()
goto(-110,-110)
down()
color('yellow')
pensize(2)
shape('classic')
for i in range(4):
fd(220)
lt(90)
reset()
screensize(900,900)
pensize(3)
color('#f037ea', 'yellow')
for i in range(6):
begin_fill()
circle(50)
end_fill()
rt(60)
color('green','red')
up()
goto(0,-100)
down()
begin_fill()
circle(100,steps=6)
end_fill()
up()
goto(0,0)
down()
for i in range(6):
circle(50,steps=6)
rt(60)
shape('turtle')
shapesize(1,1,1)
color('black','red')
stamp()
up()
goto(0,-100)
down()
stamp()
for i in range(5):
lt(30)
up()
fd(100)
lt(30)
down()
stamp()
lt(60)
up()
goto(-110,-110)
down()
color('yellow')
pensize(2)
shape('classic')
for i in range(4):
fd(220)
lt(90)
Завдання 2
from turtle import *
reset()
screensize(900,900)
up()
goto(-400,200)
down()
for i in range(6):
circle(45,90)
fd(10)
circle(-45,180)
fd(5)
circle(-15,180)
fd(5)
circle(15,180)
fd(10)
circle(45,90)
circle(45,90)
up()
goto(-400,70)
down()
for i in range(6):
fd(100)
rt(90)
fd(100)
rt(90)
fd(80)
rt(90)
fd(60)
rt(90)
fd(40)
rt(90)
fd(20)
rt(90)
fd(20)
lt(90)
fd(20)
lt(90)
fd(40)
lt(90)
fd(60)
lt(90)
fd(80)
lt(90)
fd(100)
lt(90)
up()
goto(-400,-60)
down()
rt(90)
for i in range(4):
fd(60)
lt(90)
fd(50)
lt(90)
fd(40)
rt(90)
fd(50)
rt(90)
fd(120)
rt(90)
fd(50)
rt(90)
fd(40)
lt(90)
fd(50)
lt(90)
fd(60)
up()
goto(-400,-200)
down()
for i in range(5):
fd(40)
lt(90)
fd(80)
rt(90)
fd(80)
rt(90)
fd(40)
rt(90)
fd(40)
lt(90)
fd(40)
lt(90)
fd(40)
reset()
screensize(900,900)
up()
goto(-400,200)
down()
for i in range(6):
circle(45,90)
fd(10)
circle(-45,180)
fd(5)
circle(-15,180)
fd(5)
circle(15,180)
fd(10)
circle(45,90)
circle(45,90)
up()
goto(-400,70)
down()
for i in range(6):
fd(100)
rt(90)
fd(100)
rt(90)
fd(80)
rt(90)
fd(60)
rt(90)
fd(40)
rt(90)
fd(20)
rt(90)
fd(20)
lt(90)
fd(20)
lt(90)
fd(40)
lt(90)
fd(60)
lt(90)
fd(80)
lt(90)
fd(100)
lt(90)
up()
goto(-400,-60)
down()
rt(90)
for i in range(4):
fd(60)
lt(90)
fd(50)
lt(90)
fd(40)
rt(90)
fd(50)
rt(90)
fd(120)
rt(90)
fd(50)
rt(90)
fd(40)
lt(90)
fd(50)
lt(90)
fd(60)
up()
goto(-400,-200)
down()
for i in range(5):
fd(40)
lt(90)
fd(80)
rt(90)
fd(80)
rt(90)
fd(40)
rt(90)
fd(40)
lt(90)
fd(40)
lt(90)
fd(40)
Завдання 3.
from turtle import *
def Syst_Koord():
shapesize(1,1,1)
shape('classic')
pensize(1)
for i in range(19):
up()
goto(-450,450-i*50)
down()
fd(900)
rt(90)
for i in range(19):
up()
goto(-450+i*50,450)
down()
fd(900)
up()
goto(-450,0)
down()
pensize(2)
lt(90)
fd(900)
up()
goto(0,-450)
down()
pensize(2)
lt(90)
fd(900)
stamp()
rt(90)
up()
goto(450,0)
down()
stamp()
for x in range(-400,450,50):
up()
goto(x+2,0)
down()
write(str(x))
up()
goto(445,0)
down()
write('x')
for y in range(-400,450,50):
up()
goto(2,y)
down()
write(str(y))
up()
goto(4,445)
down()
write('y')
ht()
reset()
screensize(1000,1000)
pensize(5)
color('orange','brown')
up()
goto(-150,450)
down()
begin_fill()
circle(-100)
up()
goto(150,450)
down()
circle(-100)
end_fill()
up()
goto(0,0)
down()
begin_fill()
circle(200)
end_fill()
up()
goto(-75,300)
down()
color('orange','#ebdf75')
begin_fill()
circle(-34)
end_fill()
up()
goto(75,300)
down()
begin_fill()
circle(-34)
end_fill()
color('blue','blue')
up()
goto(-65,265)
down()
begin_fill()
circle(-15)
up()
goto(65,265)
down()
circle(-15)
end_fill()
up()
goto(-150,0)
down()
color('orange','brown')
begin_fill()
for i in range(4):
fd(300)
rt(90)
end_fill()
begin_fill()
up()
goto(-175,50)
down()
circle(-75)
end_fill()
up()
goto(175,50)
down()
begin_fill()
circle(-75)
end_fill()
up()
goto(-150,-200)
down()
begin_fill()
circle(-75)
end_fill()
up()
goto(150,-200)
down()
begin_fill()
circle(-75)
end_fill()
color('orange','#ebdf75')
up()
goto(0,0)
down()
begin_fill()
circle(126)
end_fill()
up()
goto(-50,75)
down()
goto(0,50)
goto(50,75)
up()
goto(0,200)
down()
shape('triangle')
shapesize(3,1.5,3)
rt(90)
color('orange','red')
stamp()
color('black')
lt(90)
Syst_Koord()
def Syst_Koord():
shapesize(1,1,1)
shape('classic')
pensize(1)
for i in range(19):
up()
goto(-450,450-i*50)
down()
fd(900)
rt(90)
for i in range(19):
up()
goto(-450+i*50,450)
down()
fd(900)
up()
goto(-450,0)
down()
pensize(2)
lt(90)
fd(900)
up()
goto(0,-450)
down()
pensize(2)
lt(90)
fd(900)
stamp()
rt(90)
up()
goto(450,0)
down()
stamp()
for x in range(-400,450,50):
up()
goto(x+2,0)
down()
write(str(x))
up()
goto(445,0)
down()
write('x')
for y in range(-400,450,50):
up()
goto(2,y)
down()
write(str(y))
up()
goto(4,445)
down()
write('y')
ht()
reset()
screensize(1000,1000)
pensize(5)
color('orange','brown')
up()
goto(-150,450)
down()
begin_fill()
circle(-100)
up()
goto(150,450)
down()
circle(-100)
end_fill()
up()
goto(0,0)
down()
begin_fill()
circle(200)
end_fill()
up()
goto(-75,300)
down()
color('orange','#ebdf75')
begin_fill()
circle(-34)
end_fill()
up()
goto(75,300)
down()
begin_fill()
circle(-34)
end_fill()
color('blue','blue')
up()
goto(-65,265)
down()
begin_fill()
circle(-15)
up()
goto(65,265)
down()
circle(-15)
end_fill()
up()
goto(-150,0)
down()
color('orange','brown')
begin_fill()
for i in range(4):
fd(300)
rt(90)
end_fill()
begin_fill()
up()
goto(-175,50)
down()
circle(-75)
end_fill()
up()
goto(175,50)
down()
begin_fill()
circle(-75)
end_fill()
up()
goto(-150,-200)
down()
begin_fill()
circle(-75)
end_fill()
up()
goto(150,-200)
down()
begin_fill()
circle(-75)
end_fill()
color('orange','#ebdf75')
up()
goto(0,0)
down()
begin_fill()
circle(126)
end_fill()
up()
goto(-50,75)
down()
goto(0,50)
goto(50,75)
up()
goto(0,200)
down()
shape('triangle')
shapesize(3,1.5,3)
rt(90)
color('orange','red')
stamp()
color('black')
lt(90)
Syst_Koord()
Немає коментарів:
Дописати коментар