lab00 : Lab00 - A Gentle Introduction

num ready? description assigned due
lab00 true Lab00 - A Gentle Introduction Tue 01/23 09:00AM Wed 01/24 11:59PM

Introduction

Your first lab for this week is an introduction to programming on CSIL and in the Computer Science lab. You will write your first Python program that will print a specific text out on your computer display.

Goals for this lab

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

THE DEADLINE TO SUBMIT THIS LAB IS WEDNESDAY, 1/24 BY 11:59 PM. Details on how to submit are further down in this document.

Additionally, most of you will have a lab partner to share lab and some other duties during the rest of the quarter.

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. We hope that will not be the case in future labs!

Step by Step Instructions

Step 0: Select a lab partner

Refer to your responses to question 1 of Hw0: “What of the following things have you done before?”

Does your experience match the person with whom you are currently paired? Do you both want to work with each other? If the answer is no to either of those questions, then look around to find a different partner now.

We expect a few minutes of (hopefully not chaotic) mingling while you match up, but please try to do it quickly. You can refer to responses to question 2, “What type of computer/system(s) do you have?” if that matters to you. Research also shows that lab partners are best matched by gender, but we leave that decision to you too.

If you select a partner today, we expect you to keep that partner to work with in future labs. Please inform us if you make any changes later.

Before proceeding to Step 1, fill in your partner’s name and CoE username (if available) in response to question 4 of Hw0.’

Step 1: Verify your College of Engineering Account(s) [SHOULD BE DONE ALREADY!]

For Hw0 you were instructed to create (or confirm the existence of) a "College of Engineering" computer account. One of you must already be signed on (or you would not be reading this page right now), but we need to make sure that both of you can do that. So log out and let your partner log in now.

If either of you have arrived at your lab session without ever logging:

Notes:

If you are making up this lab assignment outside your regularly scheduled lab time (because you added the course late for example), then you should go to CSIL to do it.

Steps 2 through 7 below must be done once for each lab partner.
First complete these steps for whichever partner is currently logged on. After Step 7, you must go back and redo the steps using the other partner's account.

Step 2: Bring up a terminal window

On the Linux systems, like the ones used in the CS Labs, there 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", which is the Linux "command line".

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.)

-bash-4.2$ cd
-bash-4.2$ pwd
/cs/student/yourusername
-bash-4.2$ mkdir cs8
-bash-4.2$ cd cs8
-bash-4.2$ pwd
/cs/student/yourusername/cs8
-bash-4.2$ mkdir lab00
-bash-4.2$ cd lab00
-bash-4.2$ pwd
/cs/student/yourusername/cs8/lab00
-bash-4.2$ cd
-bash-4.2$ pwd
/cs/student/yourusername

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 4: 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 5: Save a file in IDLE

In IDLE, select "File=>New Window" 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.

Then, open a web browser to the link below.

http://www.cs.ucsb.edu/~zmatni/cs8w18/labs/lab00/hello.py

Go ahead and read it and see if you can guess what it might do. Then “select all” of the text, “copy” it and “paste” it into the new "untitled" window.

At the top of the file, type “Copied by: “ followed by your name and, if another student is working with you today, the other student’s name on the same line as yours. Make sure you type “Copied by:” exactly as shown, including capitalization.

You’ll have to save the file. Save the file with the name hello.py inside the cs8/lab00 folder you created in the previous step. Files with names ending in .py are typically understood to be Python programs.

Step 6. Run your Python program

In your IDLE window where you copied the hello.py text, pull down the menu tab that says “Run” and select “Run Module”.

What happens?

Step 7. Submit your assignment using the submit.cs program

Once you are satisfied that your program is correct, then it is time to submit it.

Please remember that in this class you must submit the program(s) to obtain any credit for the assignment; just completing the programs is not enough.

For this example, let us assume that you only had to submit 1 program (hello.py). This applies to ANY Python program you submit via this system:


In this course we will use the submit.cs.ucsb.edu system. You can make a submission from either the command line on any CS machine, or from a Web browser.

If you do not have a submit.cs account, you will first need to create one. This can be done at https://submit.cs.ucsb.edu/form/user.

Once you have an account created, login at https://submit.cs.ucsb.edu/session.

Next, you need to join the CS8 course. Look for the “Join Class” link at the top of the page. It is in the top bar. The class, in this system, is called: CS8_w18_matni. Once you see the list of all courses, click on the “Join CS8_w18_matni” button.

BE AWARE THAT THERE IS ANOTHER SECTION OF CS8 GOING ON THIS QUARTER AND THEY TOO ARE USING SUBMIT.CS. DO NOT SUBMIT YOUR WORK IN THE OTHER CLASS SECTION ACCOUT. MAKE SURE THAT YOU ARE SUBMITTING TO CS8_w18_matni.

You should then see CS8 appear on your homepage when logging in to the submit.cs system. Click on the course now.

Now find “lab00” and click on the “Make Submission” button. It looks like this:

Make Submission Button

This is the Web interface for submitting your code for the assignment. You can now upload your source file directly on this page. The browser will open a dialog box and you will need to navigate to the directory containing your hello.py file and select it.

Once your file is uploaded, click “Submit 1 File”:

Submit 1 File Button

Once you submit, you should see a page detailing your submission. The system will automatically grade your program and will show you the results on this page after about a 1 minute delay.

Step 8: Check Submission Results

After the 1 minute delay, the submit system will show your score and give you feedback on your submission. Refresh the webpage after a minute to see this information. This usually takes one of three forms:

A correct submission with a score of 100 (in the special case of Lab00, the score should be 50, since the Hw00 is worth 50 points too). This means that your program passed all the tests for this assignment. Once you get to this point, you are finished with the assignment and will receive full credit. This case will look like this (except the number under “Value” will say 50, not 100):

Correct Submission.

An incorrect submission with a score of 0 to 49. This means that your program failed 1 or more of the tests. For this assignment, the system will show both the expected output and the output your program generated side-by-side so that you can see what went wrong. You will need to fix your program, and then do Step 7 again to re-submit. This case will look like or similar to this (maybe slightly different wording):

Incorrect Submission.

Or a submission for which compilation failed. This means that your program caused compilation errors when the system tried to compile it. You will need to interpret the compiler output and fix the errors. The system will show you the compilation command that failed along with the full error message. This case will look like this (again, with maybe slightly different wording):

Compilation Failure.

Ask your T.A. if you do not understand this crucial step.

You may submit your program multiple times before the deadline. You should really only submit after local compilation (i.e. when you run your program to check out that it works first) does not produce any errors and runs as expected - that is the most efficient and preferred way to do things. The score of the last submission uploaded before the deadline will be used as your assignment grade.

Once your submission receives a score of 100/100, you are done with this assignment. Congratulations on completing your first Python programs!

Step 9. 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:

Second partner should now log in and redo Steps 2 through 7.
The first partner should not leave though: help your partner out. Things should go much more quickly and smoothly the second time through.

Evaluation and Grading

Each student must accomplish the following to earn full credit for this lab:

You should try to complete this assignment by the end of the lab section. This first lab, however, will be accepted late without penalty from students who register for the class late, or anyone who needs extra help.


After both partners finish the lab work above

Normally this section of the labs will have optional challenges for you to work on after completing the mandatory tasks. That is, if you finish the required work early, then we want you to do additional work until the lab officially ends.

Are you one of the first pairs to finish? Then look around for classmates who might be struggling, and ask them if you can help. After all of your classmates are either done or being competently helped by someone else, then you may ask the TA to be excused. That is, today you may leave early, but only after you are sure that nobody needs your help.


If your account does not work:

If you try to create a College of Engineering account, and it does not work, then send email to support@cs.ucsb.edu. In your email,

Note: DO NOT include your password in your email to support. In fact, NEVER send your password through email, and NEVER tell anyone else your password, not even the support staff. Real support staff will NEVER ASK YOU FOR YOUR PASSWORD—not over email, and not in person. They will not need it to help you.

If someone is asking for your password over email, it is a scam called a "phishing attack"—don’t be fooled by these dastardly villains!’


Copyright 2018, Ziad Matni, CS Dept, UC Santa Barbara. Based in part on work by Phillip Conrad. Permission to copy for non-commercial, non-profit, educational purposes granted, provided appropriate credit is given; all other rights reserved.