Learning Pyret

Learning Pyret

Due Sunday 9/7 at 11:59 PM.

Note: We just updated this assignment (Wednesday at 6) to simplify your task. You will be submitting both your code and tests together, and won't have to do peer reviews for this assignment.


As a way to learn the basics of Pyret, you will implement and test some simple functions that work over lists. We strongly suggest that before you begin you read through chapter 2 of PAPL and use the documentation available at http://www.pyret.org/docs/latest/ throughout. You will be writing your code in www.code.pyret.org. If you need to work offline, you can open a code.pyret.org editor window, and it will continue to work after you have lost network connectivity.

If any of these instructions don't work for you, please email the TA list (cs173tas at cs).

To begin, please visit code.pyret.org click "Start Coding" (it may take several seconds to load), and follow the instructions to connect your brown.edu Google drive. Note: don't connect with your personal Gmail address for coursework.

"Connect to Google Drive" button

Once connected, open the following url:

List Drill tests

You should see a popup saying that you're viewing a shared file:


Save a copy to your Google Drive without changing the title (it should save as "list-drill-tests.arr").

"Save a Copy" button

In a separate tab, open the following url:

List Drill code

And save a copy to your Google Drive (it should save as "list-drill-code.arr").

Part I: Writing test cases

In the check: block in "list-drill-tests.arr", write test cases for all of the (unimplemented) functions in "list-drill-code.arr". You can run these test cases to make sure they are well-formed (e.g., that there are no syntax errors), though of course they will all fail since they are not yet implemented.

Part II: Implementing the functions

After writing your tests, you can begin to implement the assignment. You'll probably find Pyret's lists documentation helpful here. Return to your "list-drill-code.arr" file in code.pyret.org, and implement the functions. You can also run your "list-drill-tests.arr" file and (hopefully!) see that your tests start to pass.

Part III: Submission

To submit your assignment, first save your files locally by clicking "More / Download this file" in the code.pyret.org editor for each of your two files. Call them "list-drill-code.arr" and "list-drill-tests.arr" respectively (this should be the default). Next, create a zip file containing both of these files. Finally, visit


and click the "Next Step" link for the learning-pyret assignment. This will direct you to upload a file. Select the zip file you just created. You will have just one chance to submit. The page should say that the submission was successful.


You can re-open a code.pyret.org file by visiting code.pyret.org/my-programs, or, if you already have an editor open, by clicking "More > My Programs".

You can always go back to https://www.captain-teach.org/brown-cs173/assignments/ to get back to the current step for any assignment. (This is true even later in the semester if you're, e.g., in the middle of reviews.)


In all of the programming assignments for this course, we will grade both your code and your tests. We will grade your code by running our test suite against it, and making sure that our tests pass; and we will grade your tests by running both correct and incorrect solutions against them, and seeing whether they (your tests) can tell the difference.