Today’s lab will focus on using the gradescope & Blackboard systems and simple programs in Python.
Software tools needed: web browser and Python IDLE programming environment.
This course will use the on-line Blackboard system for in-class quizzes and posting grades. Blackboard should be accessible through your CUNY First account (see Hunter ICIT Blackboard page for directions on using the system and how to get help).
Quizzes are done via the Content menu (left hand side of Home screen). I will provide the password for the quiz.
During lab, there is a quiz on the academic integrity policy of City University of New York. The password to access the quiz will be given during lab. To complete the quiz, log on to Blackboard.
The Python programming language and IDLE environment are freely available for many platforms from python.org or Anaconda. For this class, we are using Python 3. Many features of the language (including the syntax of print statements) changed between the second and third version, so, you must use the Python 3 for submitting programs.
If you have a Mac or Windows computer, the easiest installation is Anaconda. When given the choice, choose to “Install for me only” (this avoids some odd permission problems that occur when choosing the install for everyone).
Almost all the packages we will use are automatically included in the Anaconda default installation. The two that are not, image and folium, can be installed later. We won’t need these immediately, so, you can wait on installing them.
We will be using the IDLE programming environment for Python, since it is very simple and comes with all distributions of Python
To launch IDLE:
To see that it works, type at the IDLE prompt:
print("Hello, World!")
let’s use a text window, where we can save our program for later and submit it to Gradescope (this is the basis of the first program).
In that window, type:
#Name: ...your name here...
#Date: January 30, 2021
#This program prints: Hello, World!
print("Hello, World!")
This course will use the on-line gradescope system for submitting work electronically. An email invitation to the course was sent to your email address (we used the one saved for you on CUNYFirst as of Friday, 29 January).
Now that you have just submitted your first program, let’s try some other Python commands. Here’s a quick demo (click the triangle to run the program):
Now, let’s write the same program in IDLE:
Type into your window:
import turtle
thomasH = turtle.Turtle()
for i in range(4):
thomasH.forward(100)
thomasH.right(90)
Test your program and modify until you have a octagon. When you do, add comments at the top of your program:
#Name: ...your name here...
#Date: January 30, 2021
#This program draws a octagon.
Run your program after editing to make sure you do not have any typos.
A quick overview of the parts of your second program:
To review, we introduced the turtle commands:
as well as importing the turtle package (import turtle) and creating (“instantiating”) a turtle (thomasH = turtle.Turtle()).
There are many more turtles commands. Over the next couple of classes, we will use those in the turtle chapter from the textbook. A complete list of turtle commands is part of the Python 3 documentation.
If you finish the lab early, now is a great time to get a head start on the programming problems due next week. The Programming Problem List has problem descriptions, suggested reading, and due dates next to each problem.