CS 111 - Spring 2018
Sample Code
Note that this wiki attaches the Python programs as text files. You will need to change the filenames after downloaded to remove the .txt extension, or just cut and paste from the web page.
Sound Manipulation Code:
Picture Manipulation Code:
Turtle Drawing Code
- lect02013d.py.txt - Function to draw arc where turtle is returned to original starting position before arc is drawn.
- lect02013c.py.txt - Function to draw star of a given color, where pen color is restored to original pen color. Change to the pen is localized to the function
- lect02013b.py.txt - Function to draw star of a given color, but pen color extends outside of the function
- lect02013a.py.txt - Functions to the draw star and draw circle
- lect0208g.py.txt - Adding more circles to the design from lect0208f.py
- lect0208f.py.txt - Using the loop Counter variable to change to size of the circles drawn and the color of the circles drawn
- lect0208e.py.txt - Drawing multiple circles across the world using a loop
- lect0208d.py.txt - Drawing multiple circles highlighting the difference between the 2 different "reposition Turtle" functions
- lect0208c.py.txt - Drawing multiple circles showing similarities between the 2 different "reposition turtle" functions
- lect0208b.py.txt - Moving the code to reposition a turtle into a function, making main() easier to read
- lect0208a.py.txt - Drawing two circles with the reposition code between the two function calls
- lect0206d.py.txt - Code drawing multiple Circles and multiple hexagons
- lect0206c.py.txt - Code to draw multiple "Circles" - each circle is a 30 sided polygon
- lect0206b.py.txt - Code to draw multiple Octagons using a function
- lect0206a.py.txt - Code that opens a picture on the computer, draws on it, displays it, then saves the updated picture back on the computer
- lect0201h.py.txt - Code showing how to draw on a picture rather than a world
- lect0201f.py.txt - Drawing multiple hexagons of different sizes
- lect0201e.py.txt - Drawing multiple hexagon spun around from a central point
- lect0201d.py.txt - Modifying lect0201a.py to call the drawHex function
- lect0201c.py.txt - Modifying the drawHex function to include a length parameter
- lect0201b.py.txt - Drawing two hexagons using on "drawHex" functions
- lect0201a.py.txt - Drawing multiple hexagons with one loop nesting inside another loop
- lect0130d.py.txt - Drawing two hexagons using loops
- lect0130c.py.txt - Drawing a blue square without a loop, drawing a red hexagon with a loop
- lect0130b.py.txt - Drawing a blue square and a red hexagon
- lect0130a.py.txt - Drawing a blue square and a red triangle
- lect0125d.py.txt - Drawing 2 squares of different colors
- lect0125c.py.txt - Showing the difference in syntax between FUNCTIONS and METHODS
- lect0125b.py.txt - Drawing 2 squares using Turtles
- lect0125a.py.txt - Draw a square using a Turtle
General Python Code
Topic revision: r25 - 2018-05-03 - 14:15:57 - Main.troy