Course Syllabus

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

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 help session (aka office hours). 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. Projects 2 and 8b require more manual grading from the TAs, so they may need one additional day. Some extra time may also be needed to grade the portfolio project, due to its complexity.

Contact Information is in the "Where to go for help?" section of the Syllabus.


This course is aimed at expanding and optimizing the mental models of thinking and solving real life problems that you learned in CS 161 and also come up with new ones of your own! And we are here to help you in this journey! If you have any questions about anything during the term, please feel free to post them on Ed Discussion or Teams or send us a direct message on Teams.

Instructor: Luyao Zhang

Instructor: Tim Alcon

Sr Instructor: Pam Van Londen

Syllabus(PDF) <--all the details

Schedule(PDF) <-- like the list below

Holidays this term (Instructors and TAs will not be working):

  • Dr. Martin Luther King Day (observed on Monday, January 15, 2024).
Syllabus quiz

Please always prefix your subject with [CS162] when emailing.

Instructor Help Sessions / Office Hours:

  • Luyao Zhang:
    • Available for help Session on Teams: Tuesday 1-3 PM. I will also be on Teams from Monday to Wednesday afternoon for one-on-one sessions.  Please send me a direct message on Teams to schedule a slot if you need any hands on help.

  • Pam Van Londen:
  • Tim Alcon:
    • Available for help sessions on teams Thursdays 11am-1pm
    • I also check Ed Discussions frequently and usually respond pretty quickly

Discussion Forums and Help Session Location:

  • Ed Discussion (a Q&A forum for help from the instructor and other students). To access the forum click on the 'Ed Discussions' in the left navigation.
  • Teams (a forum for help sessions and also for more informal interaction with other students).

TA Help Sessions will be hosted in the General channel on Teams (From Monday of week 1 - Sunday of week 10).  

Pacific Time Monday Tuesday Wednesday Thursday Friday Saturday Sunday
9:00 AM
9:30 AM
10:00 AM
10:30 AM
11:00 AM
11:30 AM
12:00 PM
12:30 PM
1:00 PM
1:30 PM
2:00 PM
2:30 PM
3:00 PM
3:30 PM
4:00 PM
4:30 PM
5:00 PM
5:30 PM
6:00 PM
6:30 PM
7:00 PM
7:30 PM
8:00 PM


Individual Grading assignment and TAs' email address (updated later): 

Student last name from to            Grading TA                         Email

A---Bo                                             Morgan Baker          
Br---Cl                                             Khaled Hassan         
Co---Es                                            Derrick Higgins        
Et---G                                              Frank Hodges           
H---J                                                Susan Joh                 
K---La                                              Giovanni Propersi    
Le---Ma                                           Em Rickrode             
Mc---Nu                                          Richelle Thompson  
Ny---Po                                           Luck Tran                  
Pr---Se                                             Patricia Williams      
Sh---V                                              Sandra Yee                
W---Z                                              Darren Zheng           

Darren Zheng is our lead TA.  If you want to discuss your grade with your grading TA, you could include Darren in the conversation as well.

Other Resources:



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 is the tool that was used to create the interactive exercises in the lessons.


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.


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


  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):
    Python welcome screen
  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).
    Image of dialog box for cloning a Python project from GitHub
  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".
    Image of dialog box for setting the path to the Python interpreter for a project
  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".
    Image of dialog box for setting the path to Git
  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).
    Image of dialog box for setting the path Python interpreter to use as a default for new projects
  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 "" (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. In the file you just created, write the code for your Student class and your basic_stats function, following the specifications given in the readme file. Remember to follow the Code Style Requirements.
  11. To test your code, you'll need to write tests that calls your function. An example of this is shown in the readme, but don't just stop at one test - run whatever tests you need to to feel confident that your code meets all of the specifications for any valid inputs.
  12. Now select "Run/Run..." and select the file you want to run ("basic_stats"). If you look in the console window below, you'll hopefully see that it displays the correct results for your tests. 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. If the console didn't display the correct results for you tests, then debug your code until you do get the correct results. If you need help, remember that you can always make a post on Ed Discussion, and you can make it anonymous if desired.

Use PyCharm to commit and push changes

  1. To commit and push changes to GitHub, on Mac click Mac git commit icon on the toolbar in the upper right, or on Windows click the Windows git commit icon icon in the vertical toolbar on the left. 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).
    Image of dialog box for committing and pushing a project
  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 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

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