본문 바로가기
프로그램/Python 1000제

Python 211제] 두근두근 파이썬(개정판) CHAPTER 2 연습문제 p71

by 건티 2023. 9. 11.
728x90

출처 : 반크_반크 20년 백서

 

8.

참고풀이]

import turtle
t=turtle.Turtle()
t.shape("turtle")
t.pensize(6)
radius=100

t.up()
t.goto(-200,0)
t.down()
t.color("blue")
t.circle(radius)

t.up()
t.goto(20,0)
t.down()
t.color("black")
t.circle(radius)

t.up()
t.goto(240,0)
t.down()
t.color("red")
t.circle(radius)

t.up()
t.goto(-90,-120)
t.down()
t.color("yellow")
t.circle(radius)

t.up()
t.goto(130,-120)
t.down()
t.color("green")
t.circle(radius)

 

참고풀이 결과]

 

 

9.

참고풀이]

import turtle
t=turtle.Turtle()

s1=60 #가로, x위치
s2=40 #세로, y위치
s3=30 #반지름

t.up()
t.goto(-s1,s2)
t.down()
t.color("purple")
t.begin_fill()
t.forward(s1*2)
t.right(90)
t.forward(s2)
t.right(90)
t.forward(s1*2)
t.right(90)
t.forward(s2)
t.end_fill()

t.up()
t.goto(-s1*2,0)
t.down()
t.color("blue")
t.begin_fill()
t.right(90)
t.forward(s1*4)
t.right(90)
t.forward(s2*2)
t.right(90)
t.forward(s1*4)
t.right(90)
t.forward(s2*2)
t.end_fill()

t.up()
t.goto(-s1+(s1/2),-s2*2)
t.down()
t.color("black")
t.begin_fill()
t.circle(s3)
t.end_fill()

t.up()
t.goto(s1+(s1/2),-s2*2)
t.down()
t.color("black")
t.begin_fill()
t.circle(s3)
t.end_fill()

참고풀이 결과]

 

 

 

 

 

대한민국의 아름다운 영토, 독도의 여름

 

반응형

댓글