Skip to main content

Coding 1 - Before You Start

Access the Docassemble Server

Before you start the Coding 1 exercises you must have gained access to the Docassemble server. See Chapter One for instructions.

Read the Textbook

Make sure you have read through and are comfortable with these parts of this textbook:

Watch the videos

Watch these videos

A note on the videos

You will notice that the videos were produced for a topic called LLAW3301 Law in a Digital Age. This is the predecessor topic to Digital Lawyer. Despite this the videos are still very useful resources as most of Chapter 2 of ULT was based on them. You might want to read each part of Chapter 2 and watch each video in turn. If so, here's a handy table:

Part of Chapter 2Corresponding Video
Hello WorldC1.01
Docassemble SyntaxNo specific video. But syntax is covered to some degree in all the videos
Hello World 2 - Introducing Markdown And MakoC1.02
Hello World 3 - Buttons And More MarkdownC1.03
Hello World 4 - More Mako, Multiple Questions, Tables

C1.04

Vital Statistics - A More Sophisticated ExampleC1.06
note

The first two minutes of C1.04 deal with GitHub. We are not using GitHub in this topic, so ignore this part.

Other Handy Tips

Other handy tips:

  • You can copy and paste the code referred to in each video from each chapter part. The videos may refer to the code by different names but the code is the same.
  • Ignore references to 'Law in a Digital Age'. Pretend that I'm saying 'Digital Lawyer' instead 😊.
  • Some videos refer to you working in groups. Ignore this. The Digital Age topic was heavily group-based, where this topic does not contain any (assessed) group work.
  • Don't forget to ignore references to GitHub.

Complete these coding Exercises

Exercise 1a

References:

Make your own hello world program in your Playground:

  • Add a new file
  • Call it ABC_hello_world.yml (Replace ABC with your initials)
  • Create a single mandatory question block that displays 'Hello world' (base your code on hello_world.yml in the video)./references/ex1a_references.mdx

Exercise 1b

References:

Modify your Exercise 1a code to add a question block to ask for your name.

Exercise 1c

References:

Modify your Exercise 1b code to:

  • add exit and restart buttons;
  • re-format your question block so that the question is asked in the subquestion tag;
  • Diplay the user's name in bold; and
  • when pressing Exit your app should send you to the Flinders University BGL website.
Challenge

Add a second question that asks for the user's age. Display the result in the app's output.

Exercise 1d

References:

Modify your Exercise 1c code to:

  • add a question to ask for your salutation;
  • replace the name question with two fields for a first and last name;
  • display the output in a table. The table should contain two rows with:
    • the first row containing the name. It should display the full name (ie: join the salutation, first and last names together); and
    • the second row shoudl contain the age.

Exercise 1e

We're not doing Exercise 1e for this class

Exercise 1f

Extend your code from Exercise 1e to do the following:

  • ask for the user's annual income;
  • the term 'annual income' should have a pop-up that defines what annual income means;
  • If the user inputs an income, it should be displayed in the final screen as currency (hint: use the currency() function)
  • If the user inputs an income of $0, then the text 'you do not earn an income' should be displayed in the final screen.
Example output

Hello Hansel Forrest, you are an adult and your annual income is $45,000.