0. はじめに
-
MYJLab Advent Calendar 2021 16日目の記事です.
- 昨日は@Tyanri_氏の『PyCaret使ってみる』でした.数行のコードでデータの前処理から様々な機械学習手法の精度比較までしてくれるライブラリのPyCaretを紹介してくれました.
-
Google Colab と Turtle で描くアルファベット一覧(大文字編)の続きです.
- Google Colaboratory と Turtle(タートルグラフィックス)でのアルファベットの描き方をまとめました.
- Turtleに命令を出して動かすことで簡単に文字を描くことができます.
1. Turtle で描くアルファベット小文字一覧
- 一画目:赤色
- 二画目:青色
- 三画目:黄色
- 四画目:緑色
a
a.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(40)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(27):
turtle.left(10)
turtle.forward(5)
turtle.penup()
# 一画目→二画目準備
turtle.right(130)
turtle.backward(50)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(60)
turtle.penup()
turtle.hideturtle()
b
b.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
# 一画目→二画目準備
turtle.backward(45)
turtle.left(130)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
for i in range(25):
turtle.right(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
c
c.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(40)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(28):
turtle.left(10)
turtle.forward(6)
turtle.penup()
turtle.hideturtle()
d
d.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
# 一画目→二画目準備
turtle.backward(45)
turtle.right(130)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
for i in range(25):
turtle.left(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
e
e.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.right(90)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(50)
turtle.penup()
# 一画目→二画目準備
turtle.left(100)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
for i in range(32):
turtle.left(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
f
f.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(20)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(8):
turtle.left(20)
turtle.forward(5)
turtle.forward(75)
turtle.penup()
# 一画目→二画目準備
turtle.backward(60)
turtle.right(90)
turtle.backward(20)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(40)
turtle.penup()
turtle.hideturtle()
g
g.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(40)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(28):
turtle.left(10)
turtle.forward(4)
turtle.penup()
# 一画目→二画目準備
turtle.right(140)
turtle.backward(40)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(70)
for i in range(14):
turtle.right(10)
turtle.forward(4)
turtle.penup()
turtle.hideturtle()
h
h.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
# 一画目→二画目準備
turtle.left(180)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(45)
turtle.right(30)
for i in range(11):
turtle.right(10)
turtle.forward(5)
turtle.right(40)
turtle.forward(45)
turtle.penup()
turtle.hideturtle()
i
i.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(50)
turtle.penup()
# 一画目→二画目準備
turtle.backward(70)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(10)
turtle.penup()
turtle.hideturtle()
j
j.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(50)
for i in range(12):
turtle.right(15)
turtle.forward(5)
turtle.penup()
# 一画目→二画目準備
turtle.forward(65)
turtle.right(90)
turtle.forward(38)
turtle.right(90)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(10)
turtle.penup()
turtle.hideturtle()
k
k.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
# 一画目→二画目準備
turtle.backward(30)
turtle.right(45)
turtle.backward(45)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(45)
turtle.penup()
# 二画目→三画目準備
turtle.left(90)
# 三画目
turtle.pendown()
turtle.pencolor("yellow")
turtle.forward(45)
turtle.penup()
turtle.hideturtle()
l
l.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
turtle.hideturtle()
m
m.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(60)
turtle.penup()
# 一画目→二画目準備
turtle.left(180)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(45)
turtle.right(30)
for i in range(11):
turtle.right(10)
turtle.forward(5)
turtle.right(40)
turtle.forward(45)
turtle.penup()
# 二画目→三画目準備
turtle.left(180)
# 三画目
turtle.pendown()
turtle.pencolor("yellow")
turtle.forward(45)
turtle.right(30)
for i in range(11):
turtle.right(10)
turtle.forward(5)
turtle.right(40)
turtle.forward(45)
turtle.penup()
turtle.hideturtle()
n
n.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(60)
turtle.penup()
# 一画目→二画目準備
turtle.left(180)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(45)
turtle.right(30)
for i in range(11):
turtle.right(10)
turtle.forward(5)
turtle.right(40)
turtle.forward(45)
turtle.penup()
turtle.hideturtle()
o
o.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(100)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(7):
turtle.left(10)
turtle.forward(6)
turtle.setheading(90)
turtle.forward(20)
turtle.left(10)
for i in range(7):
turtle.left(10)
turtle.forward(6)
turtle.setheading(350)
for i in range(7):
turtle.left(10)
turtle.forward(6)
turtle.setheading(270)
turtle.forward(20)
turtle.left(10)
for i in range(7):
turtle.left(10)
turtle.forward(6)
turtle.penup()
turtle.hideturtle()
p
p.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(90)
turtle.penup()
# 一画目→二画目準備
turtle.backward(80)
turtle.left(145)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
for i in range(28):
turtle.right(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
q
q.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(35)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(28):
turtle.left(10)
turtle.forward(5)
turtle.penup()
# 一画目→二画目準備
turtle.right(135)
turtle.backward(50)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(90)
turtle.penup()
turtle.hideturtle()
r
r.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(60)
turtle.penup()
# 一画目→二画目準備
turtle.left(180)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(45)
turtle.right(30)
for i in range(6):
turtle.right(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
s
s.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(20)
# 一画目
turtle.pendown()
turtle.pencolor("red")
for i in range(14):
turtle.left(10)
turtle.forward(5)
turtle.left(20)
turtle.forward(10)
turtle.left(70)
turtle.forward(54)
turtle.right(70)
turtle.forward(10)
turtle.right(20)
for i in range(14):
turtle.right(10)
turtle.forward(5)
turtle.penup()
turtle.hideturtle()
t
t.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(75)
turtle.penup()
# 一画目→二画目準備
turtle.backward(60)
turtle.left(90)
turtle.backward(20)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(40)
turtle.penup()
turtle.hideturtle()
u
u.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=8)
# 一画目準備
turtle.left(180)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(45)
turtle.left(30)
for i in range(11):
turtle.left(10)
turtle.forward(5)
turtle.left(40)
turtle.forward(45)
turtle.penup()
# 一画目→二画目準備
turtle.left(180)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(60)
turtle.penup()
turtle.hideturtle()
v
v.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.right(155)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(75)
turtle.penup()
# 一画目→二画目準備
turtle.right(50)
turtle.backward(75)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(75)
turtle.penup()
turtle.hideturtle()
w
w.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.right(160)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(75)
turtle.penup()
# 一画目→二画目準備
turtle.right(40)
turtle.backward(70)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(70)
turtle.penup()
# 二画目→三画目準備
turtle.backward(70)
turtle.left(40)
# 三画目
turtle.pendown()
turtle.pencolor("yellow")
turtle.forward(70)
turtle.penup()
# 三画目→四画目準備
turtle.right(40)
turtle.backward(75)
# 四画目
turtle.pendown()
turtle.pencolor("green")
turtle.forward(75)
turtle.penup()
turtle.hideturtle()
x
x.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.right(140)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(75)
turtle.penup()
# 一画目→二画目準備
turtle.right(40)
turtle.backward(58)
turtle.right(40)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(75)
turtle.penup()
turtle.hideturtle()
y
y.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.right(150)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(45)
turtle.penup()
# 一画目→二画目準備
turtle.right(60)
turtle.backward(45)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(85)
turtle.penup()
turtle.hideturtle()
z
z.ipynb
initializeTurtle(initial_window_size=(300, 300), initial_speed=5)
# 一画目準備
turtle.right(90)
# 一画目
turtle.pendown()
turtle.pencolor("red")
turtle.forward(48)
turtle.penup()
# 一画目→二画目準備
turtle.right(125)
# 二画目
turtle.pendown()
turtle.pencolor("blue")
turtle.forward(75)
turtle.penup()
# 二画目→三画目準備
turtle.left(125)
# 三画目
turtle.pendown()
turtle.pencolor("yellow")
turtle.forward(48)
turtle.penup()
turtle.hideturtle()