Remove .md and image files and move python files into main chapter folders
This commit is contained in:
parent
5978779a9a
commit
67806dab6a
159 changed files with 0 additions and 4562 deletions
38
thinkcspy/Chapter-6-Exercises/problem5.py
Normal file
38
thinkcspy/Chapter-6-Exercises/problem5.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Runestone.Academy thinkcspy course
|
||||
# Chapter 6
|
||||
# Problem 5
|
||||
|
||||
import turtle
|
||||
|
||||
def drawSquareSpiral(t, sz, num, angle):
|
||||
"""Get turtle t to draw a square of sz side"""
|
||||
|
||||
for i in range(num):
|
||||
t.forward(sz*i)
|
||||
t.left(angle)
|
||||
|
||||
wn = turtle.Screen()
|
||||
wn.setworldcoordinates(-300,-300,300,300)
|
||||
wn.bgcolor("lightgreen")
|
||||
|
||||
|
||||
alex = turtle.Turtle()
|
||||
alex.color("blue")
|
||||
alex.speed(0)
|
||||
alex.up()
|
||||
alex.goto(-150,0)
|
||||
alex.down()
|
||||
|
||||
tess = turtle.Turtle()
|
||||
tess.color("purple")
|
||||
tess.speed(0)
|
||||
tess.up()
|
||||
tess.goto(150,0)
|
||||
tess.down()
|
||||
|
||||
drawSquareSpiral(alex,2,100,90)
|
||||
|
||||
drawSquareSpiral(tess,2,100,91)
|
||||
|
||||
|
||||
wn.exitonclick()
|
||||
Loading…
Reference in a new issue