repl.it
@EdgarArcia/

Turtle 1-5

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
28
29
# The following code creates a square of different colors
#

import turtle

t = turtle.Turtle()
t.speed(30000000)
colors = ['black','green','tan','purple','maroon','yellow','pink','gold','blue']
width = 110
for i in range(0, len(colors)):
  t.color(colors[i])
  current = width - (10*(i +1))

  for j in range(0,4):
    t.forward(current)
    t.left(90)

  t.penup()
  t.forward(5)
  t.left(90)
  t.forward(5)
  t.right(90)
  t.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