polygon - for i in range(n fd(t length rt(t angle def...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import math import sys sys.path.append("/Users/Genius/Documents/CS5NM/swampy.1.1") from TurtleWorld import * world = TurtleWorld() bob = Turtle() print bob def square(t, length): for i in range(4): fd(t, length) rt(t) def polygon(t, n, length): angle = 360.0 / n
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for i in range(n): fd(t, length) rt(t, angle) def circle(t, r): circumference = 2 * math.pi * r n = int(circumference / 3) + 1 length = circumference / n polygon(t, n, length) circle(bob, 10) wait_for_user()...
View Full Document

This note was uploaded on 08/28/2009 for the course CS 50 taught by Professor Staff during the Spring '08 term at UCSB.

Ask a homework question - tutors are online