@EdgarArcia/

Turtle 1-3

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# The following code creates a square of different colors
#

import turtle

jirafe = turtle.Turtle()
jirafe.speed(1000000000000000000000000000)
colors =['blue', 'red', 'yellow', 'purple', 'green', 'brown', 'gold', 'grey', 'turquoise', 'tan']
width = 110

for i in range(0, len(colors)):
  jirafe.color(colors[i])
  curent = width - (10 * (i + 1))

  for a in range(0,4):
    jirafe.forward(curent)
    jirafe.left(90)

  jirafe.penup()
  jirafe.forward(5)
  jirafe.left(90)
  jirafe.forward(5)
  jirafe.right(90)
  jirafe.pendown()
# Write a program that creates 10 squares of different colors, each one 
# inside of the others, alternating the color of the sides
#
result
console