Please note that some links on the course syllabus page are only accessible to registered students.
Two fundamental rules
- You are responsible for knowing the contents of the syllabus and all of the information about the course provided on Canvas.
- 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!
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 at @scothann or @ummaredd or @zhangluy or @muhatie
Instructor: Luyao Zhang
Instructor: Doshna Umma Reddy
Instructor: Eric Muhati
Holidays this term (Instructors and TAs will not be working):
- November 11
- November 24
- November 25
Please always prefix your subject with [CS162] when emailing.
Instructor Help Sessions (aka Office Hours):
- Luyao Zhang:email@example.com
- Available for help Session on Teams: Wednesday 12:30-2:30 PM. Other time is available upon request.
- Doshna Umma Reddy:firstname.lastname@example.org
- Available for help Session on Teams: Friday 2:00-3:30 PM or by appointment. Other time is available upon request. Please include [CS162] in your subject line when emailing.
- In addition to help session I will conduct Q&A session on Mondays from 4:30-5:30 PM on Zoom. I will share the meeting details over weekly announcements.
- Eric Muhati: email@example.com
- Available for help Session on Teams: Tuesday 2-3:30 PM or by appointment. Other time is available upon request.
- Available for help Session on Teams: Tuesday 2-3:30 PM or by appointment. Other time is available upon request.
- Hannah Scott: firstname.lastname@example.org
- Email and Teams are the best way to reach me. I will be available on Teams to answer questions or help you walk through your process via chat on Thursdays 11am-12pm Pacific. Feel free to send me a chat message or tag me in the General channel on Teams any time without an appointment. (Don't worry, I turn off notifications at night so you won't wake me up :).
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); Details to join Teams can be found under start here module.
TA Help Sessions will be hosted in the General channel on Teams (From Monday of week 1 - Sunday of week 10). More sessions will be updated in week 1.
Individual Grading assignment and TAs' email address: (will be update at the end of week 0)
Student last name from to Grading TA Email
A---Ba Oliver Blankenship email@example.com
Be---B Austin Webber firstname.lastname@example.org
C---Di Chelsea Li email@example.com
Do---Ga Darren Zheng firstname.lastname@example.org
Ge---Hav Nathaniel Luginbill email@example.com
Hay---Jo Stacey Cattell firstname.lastname@example.org
Ju---La Brandon Arsenault email@example.com
Le---Mcd Luck Tran firstname.lastname@example.org
Mcg---Ngo Isaac Best email@example.com
Ngu---Pe Julia Melchert firstname.lastname@example.org
Pf---Sa Eli Kurlbaum email@example.com
Sc---Ta Samuel Croll firstname.lastname@example.org
Te---Vo Aaron Fowler email@example.com
Vu---Z Edward Isajanyan firstname.lastname@example.org
Austin Webber is our lead TA. If you want to discuss your grade with your grading TA, you could include Austin in the conversation as well.
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.
Repl.it is the tool that was used to create the interactive exercises in the lessons. The exercises are embedded in the lesson pages in Canvas, but you will need to be logged into Repl.it in order to view them.
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.
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.
- Download and install the Community edition of PyCharm, found here.
- Download and install the current version of Python 3, found here.
- Download and install Git, found here (for Mac, if you're not sure which installation option to use, choose "binary installer").
- 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.
- Run PyCharm. When it starts, it will show you the welcome screen, which looks like this (except you won't have any projects yet):
- 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).
- 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".
- 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.
- 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".
- 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".
- 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).
- 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 "basic_stats.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.
- In the basic_stats.py 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.
- 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.
- 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
- To commit and push changes to GitHub, click on the toolbar (in the upper right). This will bring up the Commit Changes dialog.
- 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).
- 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.
- 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
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":
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.
The syllabus page shows a table-oriented view of the course schedule, and the basics of course grading. You can add any other comments, notes, or thoughts you have about the course structure, course policies or anything else.
To add some comments, click the "Edit" link at the top.