lab00 : Getting Started

num ready? description assigned due
lab00 true Getting Started Tue 01/08 01:00PM Fri 01/11 05:00PM


This lab is an introduction to Python programming using the Linux Computers in Phelps 3525 and CSIL. You will write your first Python program that will print a specific text output on your computer display. The TAs in the lab are there to assist you.

Goals for this lab

By the time you have completed this lab, you should be able to:

This assignment is designed to make sure you are comfortable working in the computing environment and know how to submit your work. It is mostly about mechanics, not concepts. As a result, this assignment is not particularly intellectually challenging. Future labs will require quite a bit more thought!

Step by Step Instructions

Step 1: Verify your College of Engineering Account(s)

The Gauchospace message that welcomed you to the course invited you to create a College of Engineering account (also known as a ECI account, or a CSIL account) at this link:

We hope you did that—if so, you should be able to use that account to login on the computers in Phelps 3525, as well as the computers in the CSIL lab. If you ever forget the password to your ECI/CSIL account, you can reset it here:

If your account doesn’t work, ask a course helper for assistance.

The CSIL lab, by the way, is on the ground floor of Harold Frank Hall. The glass front doors of Harold Frank Hall look out towards the ocean. Stand just outside those doors with your back towards the ocean. The doors to the CSIL lab are just on your right. (If you can’t look over your shoulder and see an great big tree, with the ocean just behind it, you are on the wrong side of the building.) Hours vary–its open almost all the time during the regular school year

Step 2: Bring up a “terminal”

On the Linux systems, there are a lot of things we can do with pointing and clicking with the mouse, just like on Windows or Mac. But there are also many things we can only do with the command line, or can do more easily with the command line.

So, one of the first steps will often be to bring up a “Terminal” window—a window that gives us access to the Linux “command line”.

terminal icon

Here’s how:

Step 3: Create some directories

At the command prompt, we are going to type several commands to create folders (called "directories") on Linux in which you can store your programs.The commands are shown in the box below—but first, a little explanation.

Each of the cd commands shown below is a command to "change directory"—that is to move into a different folder on the hard drive.

Each of the mkdir commands "makes a new directory" (i.e. a new folder).

Each of the pwd commands "prints the working directory", i.e. it tells you where you are on the hard drive.

At the command prompt, type each of these commands. What you type is shown in bold. You should get back exactly the output shown, (except that the part in italics may be different—each user will have something different show up there.)

NOTE: your prompt may not be exactly like the one shown here. Instead of -bash-4.2$ , you might have something like [cgaucho@cstl-15 ~]$ . The cgaucho here is your username, the cstl-15 is where you are logged in, and the ~ is your current directory. Don’t be distracted by this detail.

-bash-4.2$ cd
-bash-4.2$ pwd
-bash-4.2$ mkdir cs8
-bash-4.2$ cd cs8
-bash-4.2$ pwd
-bash-4.2$ mkdir lab00
-bash-4.2$ cd lab00
-bash-4.2$ pwd
-bash-4.2$ cd
-bash-4.2$ pwd

Step 4: Checking if it worked

To see if it worked, you can use the file manager on the desktop. Drag any windows that might be covering up the "Home" icon on your desktop—it should be near the upper left hand corner of the screen. When you double click on this icon, it will bring up your home directory. You should see inside a folder called cs8. If you double click on that, you should see inside of it, a folder called lab00.

Note that you could also use mouse clicks and menu options to create these folders, instead of the command line. If you have trouble with the command line, then for today, it is ok to do it that way.

Eventually, though, we want you to learn some of the Unix commands also—the reasons it is important to know both will become more clear as you move deeper into the study of programming and Computer Science.

Step 5: Bring up the program called IDLE

The preliminaries are done—now we are ready to start saving files for Python!

IDLE is a piece of software that you use to interact with the Python programming language. As we are using Python version 3 in this class, we also use IDLE version 3.

Type the following at the command prompt:

-bash-4.2$ idle3

The window that appears should have the Python Command prompt (>>>) in it.

When you have the IDLE window up, you are ready for the next step.

Step 6: Save a file in IDLE

In IDLE, select “File=>New File” to open a new “untitled” window for Python code.

When it comes up, click and drag the window by its title bar over to the right of your Python Shell window.

For this lab, there is one goal: write a Python 3 program that prints the string Hello, World! as its output.

In this sense, we are following a long tradition: for more than 40 years it has been a tradition to make printing Hello, World! be the first thing you do when learning a new programming language.

In Python 3, this program is very short. It looks like this:

print ('Hello, World!')

We will save the file under the name—it is very important that is has exactly that name, or the gradescope system will not run your program correctly.

That’s it! Now, you can also add, on the first line, a comment with your name, and information about the course, for example:

# Chris Gaucho, for CMPSC 8, Winter 2019
print ('Hello, World!')

You are encouraged to do that, because it helps someone looking at your code know that you wrote it. But, other than that, it isn’t necessary. In general, in computer programming, a comment is something that is intended only for human readers of the code, and is otherwise “ignored by the system”. Nearly every programming language has some way to express comments, though the exact rules for formatting of comments–that is, the syntax of comments–differs from one language to another.

In Python, a # starts a comment. Everything from the # to the end of that line is part of the comment.

Enter this program in IDLE, then save it under the name

Step 7: Running your program.

To run your program, select the “Run=>Run Module” option from the menu. You should see the “Hello World!” message.

I’ll demonstrate the use of Idle in lecture, since its much easier to just follow along than to try to explain everything in a text document. If you need a further demonstration, you can find one on YouTube. For example: This video starting at 4:53 (That video is for Python 3.1, but the stuff shown in the video is the same across all versions of Python 3.x).

Step 8: Uploading your program to Gradescope

Gradescope upload

Next, we’ll try submitting our program to Gradescope. You’ll get some immediate feedback on whether you did it properly.

If you are registered for the course, you are should also be registered at (via your account) Look in your @umail account for an email from the Gradescope system inviting you to create a password. Follow the instructions to set your password; then you should see “CMPSC 8” in your courses for this term.

The lab assignment “Lab00” should appear in your Gradescope dashboard under CMPSC 8. If you haven’t submitted anything for this assignment yet, Gradescope will prompt you to upload your files. This prompt is shown below:

You either can navigate to your file(s) or “drag-and-drop” them into the “Submit Programming Assignment” window.

After you submit something on Gradescope, you will have access to the “Autograder Results” page. There is a “Resubmit” button on the bottom right that will allow you to update the files for your submission. For this lab, if everything is correct, you’ll see a successful submission passing all of the autograder tests shown below.

Gradescope results

If the tests don’t pass, you may get some error message that may or may not be obvious at this point. Don’t worry - if the tests didn’t pass, take a minute to think if your print statement is EXACTLY like stated in the lab instructions (including the same capitalization, spaces, punctuation, etc.) and the file name is EXACTLY If your tests didn’t pass and you’re still not sure why you’re getting the error, feel free to ask one of the course helpers.

Final Step: Log Out

Actually, this is the final step of every lab, but we probably won’t remind you again after this one. In fact, you should do this every time you walk away from a lab computer, either in Phelps 3525 or CSIL. Here’s how: