This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Simple value returning function | |
| # return_test.py | |
| def pass_info(x, y): | |
| sum = x + y | |
| # nested conditional testing if a new math operation changes the sum returned? | |
| if sum < 100: | |
| sum += 1 | |
| return sum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # two_images.py | |
| # display two images | |
| import graphicsPlus as gr | |
| win = gr.GraphWin("Two Images", 1000, 1000) | |
| def two_images(): | |
| # specify image to display from same directory as file, in quotes with file extension; code determines image center point and moves accordingly | |
| image = gr.Image( gr.Point(0, 0), "flowers.ppm") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import test, two files, imports file and function, passes parameters and draws a shape | |
| # main.py | |
| import turtle as t | |
| import shapelib as lib | |
| def main(): | |
| lib.square1(100, 90) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Brent Phillips | |
| # CS5001/5003 Summer 2021 | |
| # Lab 2 | |
| # Turtle graphics, three stacked rectangles, centered, different sizes | |
| # Import turtle, open canvas, start location | |
| import turtle as t | |
| t.screensize(canvwidth = 400, canvheight = 400) | |
| def goto(x, y): | |
| t.up() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Brent Phillips | |
| # CS5001/5003 Summer 2021 | |
| # Lab 2 | |
| # Turtle graphics, three stacked squares, centered, different sizes | |
| # Import turtle, open canvas, start location | |
| import turtle as t | |
| t.screensize(canvwidth = 400, canvheight = 400) | |
| def goto(x, y): | |
| t.up() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Brent Phillips | |
| # CS5001/5003 Summer 2021 | |
| # Lab 2 | |
| # Turtle graphics, three identical stacked squares | |
| # Import turtle, open canvas, start location | |
| import turtle as t | |
| t.screensize(canvwidth = 400, canvheight = 400) | |
| def goto(x, y): | |
| t.up() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import example, imports function from a separate file | |
| # filea.py | |
| import graphicsPlus as gr | |
| import fileb as x | |
| win = gr.GraphWin("New Shapes", 800, 800) | |
| x.shape(gr, win) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| HOUSE = 0 | |
| SIZE = 1 | |
| def conflict( sideA, sideB ): | |
| sideAleft = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Brent Phillips | |
| # CS5001/5003 Spring 2021 | |
| # Project 5 | |
| # Simplied code to use for troubleshooting | |
| # Errors: | |
| """ | |
| File "/Users/brentphillips/Desktop/Gist/trouble.py", line 39, in <module> | |
| main() | |
| File "/Users/brentphillips/Desktop/Gist/trouble.py", line 32, in main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import graphicsPlus as gr | |
| import time | |
| import random | |
| # Opens graphicsPlus window | |
| win = gr.GraphWin("New Shapes", 800, 800) | |
| def circles1(): |