import turtle
swidth, sheight = 500,500 #전역 변수 부분
turtle.title('무지개색 원그리기')
turtle.shape('turtle')
turtle.setup(width=swidth+50, height=sheight+50)
turtle.screensize(swidth, sheight)
turtle.penup()
turtle.goto(5,-sheight/2)
for radius in range(1,250):
if radius % 6==0:
turtle.pencolor('red')
elif radius % 5 ==0:
turtle.pencolor('orange')
elif radius % 4 ==0:
turtle.pencolor('yellow')
elif radius % 3 ==0:
turtle.pencolor('green')
elif radius % 2 ==0:
turtle.pencolor('blue')
elif radius % 1 ==0:
turtle.pencolor('navyblue')
else:
turtle.pencolor('purple')
turtle — 터틀 그래픽 — Python 3.11.2 문서
turtle — Turtle graphics
Source code: Lib/turtle.py Introduction: Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Sey...
docs.python.org
'Data Analysis > Python Basic' 카테고리의 다른 글
[파이썬] while문을 이용한 반복문 (0) | 2023.04.03 |
---|---|
[파이썬] 터틀 프로그램 만들기 (0) | 2023.04.03 |
[파이썬] for문을 이용한 반복문 (0) | 2023.04.02 |
[파이썬] 주피터 노트북 설치 및 실행방법(feat. PDF 추출) (0) | 2023.04.02 |
[파이썬] 1부터 9까지 숫자 중에서 리스트 안에 없는 숫자 찾기 (0) | 2023.03.24 |