CS 61A uses a program called ok to test and submit homework assignments, labs, and projects.

Every programming assignment will include a .zip archive that contains the following:

  • Starter code
  • A copy of ok

After extracting the contents of the archive, you can begin your assignment.

Signing in with OK

To get started, open your terminal, and cd into the right directory (you should see a file called ok when you ls in the right directory).

Try the following command:

python3 ok

This runs the tests (don't worry if the tests fail at first; you haven't written code yet!).

The first time you run ok, you will be asked for your bCourses email address.

Please enter your bCourses email, unless it is not a Berkeley or Google email account. Otherwise, enter a Google or Google Apps email and inform your TA that you used an email that was different from your bCourses email. We use this email address to associate your code with you when grading.

After typing in your email, your web browser will open an authentication page. Click "Accept" to authenticate ok.


Not enrolled

If you see an error message that indicates you are not enrolled in the course, make sure you are using the email address that would appear on the course roster. If the email you used is correct, you may continue to use the email; your submissions will still be saved. You must contact your TA for that email address to be enrolled.

Wrong email

If you typed your email incorrectly, you can re-authenticate with the following command:

python3 ok --authenticate

Crashed or did not load

Make sure you have the 64-bit version of Python 3 installed. You can check whether you have the incorrect 32-bit version by running the following command in your terminal.

python3 -c "import struct,platform;print(8 * struct.calcsize('P'), platform.python_version())"

Can't authenticate

Double check your internet connection. If you're on campus, try using AirBears2.

Testing with OK

After writing some code, you can test your code with ok in various ways.

Test specific questions

To test a specific question, use the -q option with the name of the question:

python3 ok -q <question>

Test all questions

You can run all the tests with the following command:

python3 ok

Display all tests

By default, only tests that fail will appear. If you want to see how you did on all tests, you can use the -v option:

python3 ok -v

Test locally

If you do not want to send your progress to our server or you have any problems logging in, add the --local flag to block all communication:

python3 ok --local

Submit assignment

When you are ready to submit, run ok with the --submit option:

python3 ok --submit

After submitting, ok will display a submission URL, with which you can view your submission on okpy.org.

Viewing submissions

You can go to okpy.org to check your submissions and backups. Make sure you sign in with the same bCourses email that you authenticated with.


Adding partners on okpy.org

This video walks through adding partners on okpy.org.