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.
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.
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
Download
a1-sample.arr.Open Pyret Web IDE (you can find the link in Resources), copy and paste the content of
a1-sample.arrexcept for the lineuse context starter2024, and press Run. You should see2026 >>>in the right panel.
Type
2 + 3after>>>and press Enter. You should see2026 >>> 2 + 3 5 >>>Install VS Code with a Pyret extension (once again, see Resources), open
a1-sample.arrin VS Code, and press Run. You should see the same result as above. Repeat the experiment with2 + 3.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-divto be the sum of 3 and 5, divided by 2. - Define
purple-circto be the circle with the radius 30 and purple outline (not solid). - Define
flag-indonesiato be the flag of Indonesia of size 100x60, where the width and height are defined inflag-widthandflag-height, respectively. - Define
flag-ukraineto be the flag of Ukraine of the same size as above, but this time wrap the flag in a black frame.
Define simple functions
Download
a1-fun.arr.Complete the definition of
polynomial, adding type annotations and 3 more examples (also called test cases).Complete the definition of
two-stripe-horiz-flag, adding type annotations, the documentation, and 2 more examples.Define a new function
lower-upperthat 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 functionsstring-to-lowerandstring-to-upperto 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.
Write a response to the following questions:
- Which parts of the comparison (could be words or phrases) do you not understand? Name at least two.
- Which programming languages have you used before?
- 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.