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
32
thinkcspy/Chapter-6-Exercises/problem17.py
Normal file
32
thinkcspy/Chapter-6-Exercises/problem17.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Runestone.Academy thinkcspy course
|
||||
# Chapter 6
|
||||
# Problem 17
|
||||
|
||||
import turtle
|
||||
|
||||
def drawSprite(t, numSides, legLength):
|
||||
angle = 360/numSides
|
||||
|
||||
for i in range(numSides):
|
||||
t.forward(legLength)
|
||||
t.up()
|
||||
t.forward(-legLength)
|
||||
t.right(angle)
|
||||
t.down()
|
||||
|
||||
def fancySquare(tt, sz):
|
||||
"""Get turtle t to draw a square of sz side"""
|
||||
|
||||
for i in range(4):
|
||||
drawSprite(tt, int(sz/10), int(sz/20))
|
||||
tt.forward(sz)
|
||||
tt.left(90)
|
||||
|
||||
wn = turtle.Screen()
|
||||
wn.bgcolor("lightblue")
|
||||
|
||||
alex = turtle.Turtle()
|
||||
alex.color("maroon")
|
||||
alex.pensize(2)
|
||||
|
||||
fancySquare(alex, 100)
|
||||
Loading…
Reference in a new issue