Lab 1: Python Environment
An Introduction
Labs. During each week's lab, you will get hands-on practice with concepts from the lecture. Labs are also the starting point for the weekly project.
Projects. In the projects, you will get deeper experience working with concepts from lecture by writing Python code and running it to create outputs that you design, such as images.
Project report. You create a Google Doc with images from your project, along with a description of how you created them and what you learned. Labs and projects are tightly coupled.
Submission. Each week, you will see the current project posted on the previous webpage, along with the due date. To turn in your project, go to your the Google Drive folder I shared with you earlier and drag and drop the following files to the project folder:
The goal of today's lab is to give you to practice completing each of these steps.
Python is a simple yet powerful language for making computers do stuff. Many people have written modules for Python that do some sophisticated things. One of those modules is called turtle. We will use turtle extensively all semester!
Think of turtle as a virtual turtle that drags along a pen underneath it. As you command the turtle to move, the pen leaves ink on the virtual sheet of paper.
We can make the turtle move forward, backward, turn left, turn right, and pick up or put down the pen using the following commands.
You can find out about more turtle commands on the Python documentation site.
Text editors are the workhorse programs for writing code. Unlike Google Docs and Microsoft Word, we don't want fancy fonts or formatting. In lecture and lab, we will use the Microsoft Visual Studio Code editor (VS Code for short). Let's use VS code to write our first Python program.
Do not write code in Microsoft Word or Google Docs!
Now let's write your first Python program! Your goal is to use turtle to draw a hexagon:
Congratulations, you just ran your first Python program!
For each project, you will write a brief report in Google Docs and submit it through your Google Drive folder that I shared with you earlier.
Each report consists of:
All this will become second nature in a few weeks and is summarized in each project rubric
Let's turn in a "mock" lab report with a screenshot of your hexagon to help you get the hang of it. This is only practice, going forward you will not need to turn in labs, only projects.
Take a screenshot of your hexagon.
You can easily take a screenshot of your turtle creations to include in your reports by pressing Shift-Command-4. When you press those keys on your keyboard, a crosshair will pop up. Click and drag to draw a box around your hexagon. When you let go, a screenshot of the region that you selected gets saved to your Desktop.
Follow the "Mouse and keyboard" directions to use the Windows Snip Tool to take screenshots. You want to use the Rectangular or Window option. With the Rectangular option, you click and drag a box (while holding down the click) around your hexagon when the screen dims. Let go when you are satisfied. Once you see your screenshot preview in Snip Tool, save it to your Desktop (File -> Save As).
Move your lab folder inside your project folder. For example, if you have Lab01 and Project01 folders both on your Desktop, drag the Lab01 folder inside Project01.
Make sure your project directory includes the following files: