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

Python 220제] 두근두근 파이썬(개정판) CHAPTER 4 연습문제 p126

by 건티 2023. 11. 6.
728x90

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

 

6.

참고풀이]

L=[]
n=int(input("정수를 입력하시오 : "))
L.append(n)
n=int(input("정수를 입력하시오 : "))
L.append(n)
n=int(input("정수를 입력하시오 : "))
L.append(n)

print("\n리스트 =", L)
print("리스트 숫자들의 합 =",sum(L))

 

참고풀이 결과]

 

 

7.

참고풀이]

import turtle
t=turtle.Turtle()
t.shape("turtle")

colors=[] #"yellow","red","blue"
color=input("색상 #1을 입력하시오 : ")
colors.append(color)
color=input("색상 #2를 입력하시오 : ")
colors.append(color)
color=input("색상 #3을 입력하시오 : ")
colors.append(color)

t.up()
t.goto(-200,0)
t.down()

t.fillcolor(colors[0])
t.begin_fill()
t.circle(100)
t.end_fill()

t.up()
t.goto(0,0)
t.down()

t.fillcolor(colors[1])
t.begin_fill()
t.circle(100)
t.end_fill()

t.up()
t.goto(200,0)
t.down()

t.fillcolor(colors[2])
t.begin_fill()
t.circle(100)
t.end_fill()

 

참고풀이 결과]

 

 

8.

참고풀이]

import turtle
t=turtle.Turtle()
t.shape("turtle")

X=[]
Y=[]
x1=int(input("x1 : "))
y1=int(input("y1 : "))
X.append(x1)
Y.append(y1)

x2=int(input("x2 : "))
y2=int(input("y2 : "))
X.append(x2)
Y.append(y2)

x3=int(input("x3 : "))
y3=int(input("y3 : "))
X.append(x3)
Y.append(y3)

t.goto(X[0],Y[0])
t.goto(X[1],Y[1])
t.goto(X[2],Y[2])

 

참고풀이 결과]

 

 

 

 

 

 

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

 

반응형

댓글