Back

Challenge Set 6

Unlocks after Activity 1.15. Three code challenges, all driven by a brief.

divider

What This Set Is For

Ride Check and Drone Check both need more than one fact before they have an answer. Tall enough and old enough. Calm enough and charged enough and not raining. That is what &&, ||, and ! are for.

Both also have an override, and that is the harder half. One rule in each brief beats the others, and getting it to beat exactly the right ones — and no more — is where these are won or lost.

Study Hall Pass is the plain case, on purpose. One &&, both facts required, no exception and no override. Meet the operator here before Ride Check and Drone Check ask you to combine it with one.


Write the Parentheses

Activity 1.15 showed that && binds tighter than ||, so a condition with both in it does not read left to right. It compiles either way and gives you a different answer, with no warning.

Ride Check and Drone Check both mix the two operators. Parentheses cost nothing, they say what you meant, and they are the difference between a rule you wrote and a rule the language picked for you. Study Hall Pass uses only &&, so there is nothing to get backwards there — it is this set's plain case, not its parentheses lesson.


Both Are Briefs

Nobody lists the steps on either page. You get a result somebody wants, and you write the requirements list first — input, calculate, output, and every decision you had to make yourself.

If that is unfamiliar, read it once here: How to Read a Brief, in Challenge Set 1.


The Challenges

Study Hall Pass is one &&, no exception, no override — start here. Ride Check has an exception that applies to one rule and not the other, and the parentheses are what say which. Drone Check has a rule that beats everything, and its harder half is deciding what to report when two things are wrong at once.

These are options, not a checklist. Pick whichever combination gets you to what the dropbox asks for — Study Hall Pass is the easiest way in if the overrides in the other two feel like too much at once.


Which Homework These Feed

These feed the build drop after Activity 1.16, which finishes Part 2's five — these three, plus the ones under Activity 1.16 and anything you did not use from Challenge Set 4 or Challenge Set 5.

The dropbox says how many. This page only says what is available.

Commence Challenges