Learn
Conditionals
Grouping Expressions

In Math class, we might have been asked to solve equations like:

``2 * 6 + 10 / 2``

If we read out our equation from left to right we might think that the answer is `11`. However, itβs actually `17` because we have to follow a specific order of operations. In the United States, thereβs a helpful mnemonic called PEMDAS that helps us remember to the order:

1. `2 * 6`, which is `12`
2. Then we have to divide! So `10 / 2` is `5`.
3. Lastly, we add `12` and `5` to get `17`!

But wouldnβt it be nice if someone put in parentheses to group together expressions for us to evaluate? That way we donβt have to remember the specific ordering. Our neatly grouped expression would be:

``(2 * 6) + (10 / 2)``

The insertion of parentheses makes it clear which operations are done first. Emojicode also has its own order of operations that determines the order in which expressions are evaluated. But, we can control the order using the emoji equivalent of parentheses, `( )`, `π€ π€`. When we translate our math equation to Emojicode, we get:

``π€ 2 βοΈ 6 π€ β π€ 10 β 2 π€``

Using `π€ π€`, we make it clearer for which expressions go together and we decide the order of expressions.

### Instructions

1.

Letβs use `π€ π€` to make our first conditional easier to read.

Currently, we have the conditional:

``````βͺοΈ offer βΆοΈ minPrice π€ offer βοΈ maxPrice π
π π€Offer accepted!π€βοΈ
π``````

In the condition, add a set of `π€ π€` around `offer βΆοΈ minPrice` and another set of `π€ π€` around `offer βοΈ maxPrice`. This way we have a clear grouping of expressions.

2.

In the second conditional, the condition looks like:

``π π π π€ π``

As is, the condition evaluates to `π`. We need to group together an expression inside the condition, using a single set of `π€ π€`, to make the condition evaluate to `π`.

3.

The last expression is stored in a variable `mathPuzzle` that reads as:

``10 βοΈ 6 β 2 β 2``

It currently evaluates to `59`, but we want it to evaluate to `20` instead. Add a single set of `π€ π€` to make this happen.