A1 — Setup and first programs

Decide how to keep track of your course work, choose a development environment for Pyret, and create your first programs.

Due Sep 2, 2026

Estimated time to complete (just the assignment, excluding the prep materials): 45–90 minutes depending on your prior programming experience.

What to do

Remember that the assignment depends on the course preparation materials, which are published in Schedule.

Personal organization

For the questions below, do the thinking first, and then write down your answer in a few sentences. Submit your answers to Assignment 1 on Brightspace along with the code from the other sections of this assignment.

  1. Decide how you will keep track of your course work and deadlines, and pick some tools to help you do that (examples: physical or digital task list, calendar). Name your tools and describe your process for keeping track of your work.

  2. For this course, we want you to keep track of how much time you spend on all course related activities (including classes, prep materials, assignments). Ideally, you will have a separate record for prep materials and assignments, but at the very least, keep track of the total time spent on this course. Name the tool you will use to keep track of your time.
    Note: each week, you will be asked to submit an anonymous survey about the time spent on the course and your estimate for how much of the weekly workload you completed. This will help us maintain reasonable workload levels.

Set the environment

  1. Download a1-sample.arr.

  2. Open Pyret Web IDE (you can find the link in Resources), copy and paste the content of a1-sample.arr except for the line use context starter2024, and press Run. You should see

    2026
    >>>

    in the right panel.

  3. Type 2 + 3 after >>> and press Enter. You should see

    2026
    >>> 2 + 3
    5
    >>>
  4. Install VS Code with a Pyret extension (once again, see Resources), open a1-sample.arr in VS Code, and press Run. You should see the same result as above. Repeat the experiment with 2 + 3.

  5. Choose the environment you prefer and decide where to keep the files you are working on.

Note. You will need to submit .arr files for grading, so whatever you decide, make sure you keep your work somewhere. We recommend that you also back up your files somewhere besides your personal computer. As an option, you can use Your files on Brightspace.

Define simple expressions

Add the following definitions to a1-sample.arr in the given order, all before the last expression (which is 2026).

  • Define sum-div to be the sum of 3 and 5, divided by 2.
  • Define purple-circ to be the circle with the radius 30 and purple outline (not solid).
  • Define flag-indonesia to be the flag of Indonesia of size 100x60, where the width and height are defined in flag-width and flag-height, respectively.
  • Define flag-ukraine to be the flag of Ukraine of the same size as above, but this time wrap the flag in a black frame.

Define simple functions

  1. Download a1-fun.arr.

  2. Complete the definition of polynomial, adding type annotations and 3 more examples (also called test cases).

  3. Complete the definition of two-stripe-horiz-flag, adding type annotations, the documentation, and 2 more examples.

  4. Define a new function lower-upper that takes a string and returns a string that is the concatenation of the lower-case version of the string, an ampersand, and the upper-case version of the string. Note: you may use the built-in functions string-to-lower and string-to-upper to help you.

Submit your work

Submit your written responses and the two .arr files to Assignment 1 Submission on Brightspace. Do not change the names of the files—they will be auto-graded, and the grading system will not recognize them if you rename the files, so you will get 0 for this part of the assignment.

Optional: compare Pyret and your previous language

Note: this part is not graded, but if you have prior programming experience, it may be an interesting exercise for you.

  • Read the comparison between Pyret and Python from DCIC.

  • Write a response to the following questions:

    1. Which parts of the comparison (could be words or phrases) do you not understand? Name at least two.
    2. Which programming languages have you used before?
    3. Try to find at least two differences between one of your previous languages and Pyret.

Grading

Written responses will be graded for completion. The code will be auto-graded for correctness, but remember that coding style and program design will be graded on exams.