Today's lab will focus on using the Gradescope system and simple programs in Python.
Software tools needed: web browser and Python IDLE programming environment.
CSci 127 has a laboratory, 1001E North, dedicated for its use. The room has a flexible set-up to encourage group work and laptop computers that can be checked out for use in the room only. When you enter the room, hand your Hunter ID to undergraduate teaching assistant in exchange for a laptop computer. At the end of lab, make sure to return your computer to its docking station so that it can be charged.
The laptops run Ubuntu Linux operating system. When you open the laptop, choose the "Computer Science Guest" account (the password is: 1001E!88). On the left hand side is a bar of icons, including icons for a browser (for accessing webpages) and the terminal window (for writing commands and launching programs).
When you launch the browser in the lab, you will see the standard HunterNet webpage. Fill in the form with your Hunter credentials (the same that you would use to access the wifi from your own computer or phone) to access the internet. If you get a message that you are not connected to the internet, click on the internet symbol (empty quarter circle) in the upper right corner of the toolbar. Hover over the "More Networks" and then click on "HunterNet". The wifi symbol will blink with concentric lines. When it stops blinking and becomes solid lines, an internet connection has been established and you can then reload the webpage to type in your Hunter credentials.
This course will use the on-line Blackboard system for course announcements, lecture previews, 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). The lecture previews can be found under the Content menu (left hand side of Home screen).
We will be using the IDLE programming environment for Python, since it is very simple and comes with all distributions of Python (if you would prefer to use another programming environment, Spyder is loaded on the lab machines).
To launch IDLE:
idle(followed by an enter/return).
Instead of using the shell window (where we can try things immediately), 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).
#Name: ...your name here... #Email: ...your email here... #Date: August 27, 2018 #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 Blackboard as of Monday, 26 August). If you did not receive the email, one of the teaching staff can regenerate it for you.
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):
A quick overview of the above program:
Now, let's write the same program in IDLE:
import turtle tia = turtle.Turtle() for i in range(4): tia.forward(150) tia.right(90)
#Name: ...your name here... #Date: August 25, 2017 #This program draws a octagon.Run your program after editing to make sure you do not have any typos.
To review, we introduced the turtle commands:
There are many more turtles commands. Over the next couple of classes, we will use those in the turtle chapter from the textbook. In addition to the ones that control movement, you can also change the color of the turtle, change the size of the drawing pen, and change the backbround color (by making a window or screen object, and changing it's color):
A complete list of turtle commands is part of the Python 3 documentation.
Since the lab computers are shared, student files are regularly removed from the computer. Any of your work that you would like to save, you should email to yourself, put in your dropbox, or save on a USB drive.
If you finish the lab early, now is a great time to get a head start on the programming problems due next week. There are instructors to help you, and you already have Python up and running. The Programming Problem List has problem descriptions, suggested reading, and due dates next to each problem.
If you have a Linux machine and would like to match the environment on the lab machines, at a terminal window, type the following commands:
sudo apt-get update sudo apt-get -y upgrade sudo apt-get install python3 python3-pip idle3 pip3 install numpy pandas matplotlib scipy folium image sudo apt-get install spyder3
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 via pip (Python package manager). We won't need these immediately, so, you can wait on installing them. Here are the directions:
which pipat the terminal window.
easy_install pipAnd then add the packages:
pip install image pip install folium
There are many free on-line versions that you could use via a browser, such as pythonanywhere.