No | Name | Code | Output |
---|---|---|---|
1 | Right Turn | from turtle import * forward(100) right(90) forward(100) |
|
2 | Left Turn | from turtle import * forward(100) left(90) forward(100) |
|
3 | Square | from turtle import * forward(100) left(90) forward(100) left(90) forward(100) left(90) forward(100) |
|
4 | Angle Rays | #angles from turtle import * for angle in range(0, 360, 15): setheading(angle) forward(100) write(str(angle) + '°') backward(100) |
|
5 | Purple Square | import turtle turtle.fillcolor('purple') turtle.pensize(10) turtle.pencolor('black') turtle.begin_fill() turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.end_fill() turtle.done() |
Monday, January 28, 2019
Turtle Graphics Code Samples - 1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment