Course Syllabus

Please note that some links on the course syllabus page are only accessible to registered students.

Hello! We'll be your instructors for CS 161 - Introduction to Computer Science I. Computer science is a fascinating field, full of interesting problems to work on, and it certainly doesn't hurt that computing skills are in high demand. Whatever your particular set of motivations for taking this course, it is our hope that you will gain the knowledge and skills that will help you reach your goals.

NOTE: Some links on this page may only be accessible to registered students.

 

 

Instructor: Luyao Zhang

Instructor: Brian Baker

 

 

Syllabus (PDF)

Syllabus quiz

Schedule of assignments and quizzes (PDF)

Holidays this term (no office hours; instructors and ULAs will not be working):

  • Memorial Day: Monday, May 29, 2023

Communication Policy

Two fundamental rules

  1. You are responsible for knowing the contents of the syllabus and all of the information about the course provided on Canvas.
  2. You are responsible for knowing the contents of instructor announcements made on Canvas, which means that you should make sure you receive such announcements and that you check for new ones at least once a day.

When to email?

For all class-wide questions, we encourage you to first post on Ed Discussion if you can't make to an office hour. Only questions of a personal nature or related to your own grade should be emailed to a TA or Instructor. If you are hesitant to ask a question on Ed Discussion, you can always post anonymously and no one including the Instructors will know who posted it :) Remember, there are no stupid questions!

Response Times

When you email your TA or us (the instructors), you can normally expect a response within 24 hours. You should usually expect your assignments to be graded within five days of the due date.  Some extra time may also be needed to grade the portfolio project, due to its complexity.

Contact Information

Please put the prefix [CS161] in the subject when you send emails to us so we can identify your emails quickly.

Instructor

  • Luyao Zhang (Instructor): zhangluy@oregonstate.edu
    • If you need to meet me one-on-one for some hands on help, please send me a direct message on Teams to reserve a time.
    • I’ll be hosting weekly Office Hours on Teams general channel every Friday afternoon at 3:00PM-5:00PM Pacific.
  • Brian Baker (Instructor): bakerb6@oregonstate.edu
    • You can send me a message in Canvas and I'll get back to you within 24 hours, I try not to respond to messages on the weekend. (But you know, you might get lucky.)
    • I’ll be hosting weekly Office Hours via Zoom every Thursday afternoon at 4:00PM Pacific. These will be less focused on homework help and more to answer questions and reinforce the concepts taught that week. Which should also help with your assignments. I'll post a recording for those that cannot make it to the live session. 

TA Contact Information and Office hours: It will be posted on "Where to go for help" in the "Start Here" module.  You could also find who will be your grading TA at this page.

Ed Discussion: an ongoing Q&A forum (please use the left tab to get to the site)

Teams: a forum for office hours and also for more informal interaction with other students (please use the left tab to get to the site)

Ecampus Student Resources

Online tutoring service: Peer tutoring by the School of EECS

Students in this section may be required to interact with teachers, teaching assistants, and students in other concurrent sections of this same course.

Required textbook:  None

 

Canvas

Canvas is the LMS (Learning Management System) that you are using right now to view this course. For questions about Canvas, check this list of help topics.

Vocareum

Vocareum is the tool that was used to create the interactive exercises in the lessons.

GradeScope

At the bottom of each assignment page is a link to Gradescope, which will open in a new tab. On Gradescope you'll be able to click a link to submit your projects from GitHub.

Ed Discussion

There is a link to Ed Discussion in the left sidebar of Canvas. This ongoing Q&A forum is a valuable resource for getting official answers to your questions (and often helpful student responses also). It's good to use the search box before posting, to see if your question has already been addressed.

Teams

There is a link to Teams in the left sidebar of Canvas. This forum is for more informal interaction with your fellow students. It is also where TAs and instructors will hold office hours.

Git and GitHub

Git is a distributed version control system that makes it easy to keep backups of different versions of your code and track changes that are made to it. Later on this page, you'll install Git on your computer and tell PyCharm where it's located, so that you can use Git from PyCharm. When you commit your code, it will store a backup of the current version locally on your computer.

To do a project, you'll first clone it from a URL given on an Assignment page. Cloning a project creates your own private repository (or repo) for the project on your GitHub account. GitHub is a popular web hosting service for Git repositories. When you commit and push your code, it stores a backup of the current version both locally on your computer and in your repository for that project on GitHub. If you look in your account on GitHub, you should be able to verify that your repository was updated.

After cloning a project to your GitHub repo, you'll create a PyCharm project on your computer where you can do your coding. You'll do this by telling PyCharm the URL of your GitHub repo for that project.

You can commit and push your code as often as you feel is useful, but you'll at least want to commit and push when you finish and your code is ready to submit. You submit your code on Gradescope, and it's pulled from your GitHub repo, which is why you want to make sure you commit and push to GitHub before submitting on Gradescope.

PyCharm

PyCharm is the IDE (Integrated Development Environment) that you will use in this course to develop your assignments. You can use it to create your own projects from scratch, but for the assignments in this course, you'll be creating projects in PyCharm via GitHub as mentioned in the preceding section. We'll walk through the individual steps below, using Assignment 1 as an example.

The screenshots are from Mac, but the steps are very similar for both Mac and Windows.

Preliminaries

  1. Download and install the Community edition of PyCharm, found here.
  2. Download and install the current version of Python 3, found here.
  3. Download and install Git, found here (for Mac, if you're not sure which installation option to use, choose "binary installer").

Assignment 1

  1. Go to the Assignment 1 page and click on the URL for Project 1 (most assignments will have more than one project). When you accept the invitation, it will clone the project and give you the URL of your new project repository. Copy that URL.
  2. Run PyCharm. When it starts, it will show you the welcome screen, which looks like this (except you won't have any projects yet):
    welcome screen.png
  3. Click on Get from VCS. You should now see a dialog that has "Git" selected for "Version control", and has an empty field for URL, which is where you will paste the URL you copied in step 1. When you do that, the directory field will be filled in automatically. Next click on "Clone" (it's grayed-out in the image, but won't be once you fill in the URL).
    Get from VCS.png
  4. The first time you do this, you'll get a dialog that says "Log in to GitHub". Click on "Use Token...", and in the next dialog, click the "Generate..." button next to the Token field. This will take you to a "New personal access token" page. Change "Expiration" to 90 days, then scroll down to the bottom and click "Generate token". You should now see a page with your personal access token, which you will copy-paste into the "Token" field of the PyCharm dialog. Now click "Log in".
  5. You should now be in a new PyCharm project based on the assignment you cloned from GitHub. You should be able to see the readme file, which contains the assignment instructions.
  6. Before proceeding with the assignment, let's make sure PyCharm knows where to find the Python interpreter you installed. Go to PyCharm/Preferences (on Mac) or File/Settings (on Windows), and then select Python Interpreter. First check whether it lists the version of Python you installed. If not, try clicking on that dropdown box to see if the version you installed is one of the options. If so, select it. If not, then you'll need to add it. Click on the gear icon to the right, select "Add...", select "System Interpreter", and click on the "..." button on the right. Now you can browse to the location of the interpreter you installed. You may have to search for where it was installed on your computer. On my Mac, that was "/usr/local/bin/python3.10". On my Windows laptop, that was "C:\Users\user name\AppData\Local\Programs\Python\Python310\python.exe".
    Python Interpreter.png
  7. We also need to make sure PyCharm knows where to find Git. Go to Preferences or Settings, and then select Version Control, and then select Git. The "Path to Git Executable" may have successfully autodetected the correct path - you can test this by clicking the "Test" button to the right.  If it doesn't work, click on the folder icon and then browse to where Git was installed. You may have to search for where it was installed on your computer. On my Mac, that was "/usr/bin/git". On my Windows laptop, that was "C:\Program Files\Git\cmd\git.exe".
    Version Control.png
  8. While we're at it, let's specify the Python interpreter to be automatically set for all newly created projects. Go to File/New Projects Setup/ (Preferences or Settings) for New Projects. Select "Python Interpreter". This time when you click on the combo box, you should see the interpreter you set in step 6 and you can just select that. If you don't see it there, then you'll need to add it similar to how you did in step 6. Now you won't have to set the interpreter for each new project (you won't need to repeat the Git step either).
    New Projects Setup.png
  9. To add a new Python file to the project, click on your project folder in the left pane and then select "File/New.../Python File", and name the new file "animal.py" (as specified in the readme). When you add a new file to the project, PyCharm will ask if you want to add the file to Git, which you do, so click "Add" (there should also be a box you can check that says "Don't ask again"). This allows you to backup that file using Git and GitHub.
  10. For the first assignment, the code is given to you in the readme - just copy it into the animal.py file you just created. The only change you need to make is to replace the info in the comment header with your name, your GitHub username, and the current date.
  11. Now select "Run/Run..." and select the file you want to run ("animal"). If you look in the console window below, you'll see that the program is now asking you to enter your favorite animal. Click on the console window, type in the name of your favorite animal and hit <enter>. The program now prints out a message that your favorite animal is that animal. Congratulations - you've just created and run a program in Python! If you want to re-run the same file, you can just click on the green triangle icon that appears both near the top-right of the PyCharm window and also near the lower-left of the window.

Use PyCharm to commit and push changes

  1. To commit and push changes to GitHub, click check.png on the toolbar (in the upper right). This will bring up the Commit Changes dialog.
  2. There should be a pane that shows the name of your Python file, with a checked box in front of it. This shows that that file will be included in the commit and push. There may be another box that says "Unversioned Files" next to it. This box should be unchecked, so that you don't back up a bunch of PyCharm project configuration files to your GitHub account (though if you do, it doesn't actually hurt anything).
    Commit and Push.png
  3. There should be another pane titled "Commit Message". Enter a commit message. A good commit message should be a brief summary of what has changed since the last commit. You won't be graded on your commit messages, but if you need to roll back to a particular version of your code, good commit messages will help you find the one you're after. This will be especially important on the job, when working on large projects with many people.
  4. From the Commit drop-down selection (in the lower right) choose "Commit and Push". Then in the pane that pops up, confirm the Push. Make sure that you commit and push. If you just commit, that will only update your local copy of the repository, not the copy on GitHub. The push is what updates the copy on GitHub.

Use Gradescope to submit your code

Open Gradescope (using either the link in the left sidebar or the one in the Assignment page), click on Project 1, and then click on "Upload Submission". You'll be asked to connect to your account and select a repository. You'll also be asked for a "Branch", for which you'll just select "main". When you finish making your submission, Gradescope will automatically run a few tests and give you some feedback which should let you know whether you submitted it correctly or not. There are "hidden" tests that you won't see the results of until after the late due date, so be sure to test your code yourself to make sure it works correctly.

The interactive Python console

Click on "Python Console" at the bottom left of your screen. This changes the bottom window from an output window to a console window, where you can use Python commands interactively. Try entering in this window the statement

print('hello world')

and hit <enter>. Interactive mode is handy for trying out simple things quickly, but for more complex things it's easier to write a program (or "script" as they're often called in interpreted languages such as Python).

If you run your animal.py file again, the bottom window will switch back to showing the output of your program.

(optional) Calling scripts from the interactive Python console in PyCharm

In the interactive exercises in the exploration pages, it's possible to call parts of a Python program (sometimes called a "script") directly from the interactive console. However in PyCharm the default settings don't allow you to do this. You don't need to be able to do that for this course, but if you would like to replicate that behavior in PyCharm, here's how.

In PyCharm, go to Run > Edit Configurations... > Check "Run with Python Console":

run with python console screen.png

Now you should be able to call parts of a Python program from the interactive Python console in PyCharm. One possible use of this is to write the program for your assignment and instead of writing test code in the same file (which you would need to delete before submitting), you could test the program by calling your code from the interactive console.

 

Course Summary:

Date Details Due