All guides

Creating an assignment with starter code

Build starter code as a draft, then publish it so every student gets their own copy.

An assignment is a folder of starter code. You build it as a draft and publish it, and every student gets their own editable copy of its files.

Create a draft

In a class, open the Assignments tab, click New assignment, and choose one:

  • Start from scratch makes an empty assignment with the name you type.
  • Upload a folder makes the folder's contents the starter code. If the name is taken, CS Room adds a number, like Lab 1 (1).
  • Use a lesson copies one of CS Room's lessons, with its tests set up when the lesson has them. You can also add a lesson from the Lessons page.

Students see nothing until you publish.

Refine the draft

Drafts sit at the top of the Assignments list, marked Draft. Click one to open its page. Open in workspace opens it in your own workspace, inside the class's assignments/ folder, where you can edit its files. Create, rename and delete assignments from the class page. The pencil beside the title renames one, draft or published, and students keep their work.

The Settings tab holds the schedule and grading:

  • Set a Due date and Close at due date appears, on by default. At the deadline CS Room collects everyone's work. With the switch on, it also grades that work, locks the grades and stops submissions. With it off, students can keep submitting late.
  • Publish on a schedule publishes the draft at a time you pick.
  • Tests and solutions sets up automated grading. See Writing assignment tests.

Once an assignment is published, Close now collects and grades everyone's work and stops submissions at any time. Reopen lets students submit again and turns off Close at due date.

Publish

Click Publish at the top of the draft's page. Every current student gets their own copy in their class folder, and students who join later get one too.

Editing after publishing

You can keep editing the files in assignments/. Students' copies are never overwritten, so an edit to a file they already have does not reach them. A file you add from the file explorer does reach every student, and hiding a file removes it from their copies.

To push a fix to an existing file, add it as a new file, or have students right-click the assignment folder and choose Restore all files. That replaces their starter files with your current version. Students who join later get your latest version.

Test files

Set up grading for each assignment in Tests and solutions on its Settings tab, either as input and output cases or as a test command. See Writing assignment tests.

A graded run uses the student's own copy of every visible file, including a test file they have edited. Only hidden files are laid over their work. Before you publish, hide the tests that decide the grade and any answer keys under File visibility in Tests and solutions. Hidden files live in the assignment's .teacher folder.

An assignment with no test settings falls back to running its test_*.py files, and uses your copies of them. Students get no Run Tests button for it, so set up tests instead.

Removing an assignment

Delete an assignment from its Settings tab, under Danger zone. Deleting a published assignment also deletes every student's copy, including their work, along with its scores, grade locks, submissions, feedback and test settings. A new assignment published later under the same name starts clean.

To retire an assignment and keep students' work, rename it instead.