2.2. Conditionals

The video below introduces how to use if/else structures to make decisions in a program.

Checkpoint Exercise

A detector:

Make a program that asks the user for a score and tells them “A” if the score is > than or = to 90. There is no ≥ block, so you have to use one of these recipes:

../../_images/CP22a.png
../../_images/CP22a_key.gif

A detector:

Improve your script so that it says “A” if they got 90 or above, “B” if they got 80 or above and “Try again” if they got below 80. You will either need to have an if/else inside an if/else or you will have to be creative using AND and OR logic with 3 separate if blocks.

Two versions:

../../_images/CP22b_key.gif ../../_images/CP22c_key.gif