Learn

Computers are incredible at doing calculations. Now that we have declared variables, let’s use them with arithmetic operators to calculate things!

Emojicode supports arithmetic operators for:

  • : addition
  • : subtraction
  • ✖️: multiplication
  • : division
  • 🚮: modulo (divides and gives the remainder)

For example:

4 ➕ 2 ➡️ score1 💭 scores1 is 6 4 ➖ 2 ➡️ score2 💭 scores2 is 2 4 ✖️ 2 ➡️ score3 💭 scores3 is 8 4 ➗ 2 ➡️ score4 💭 scores4 is 2 4 🚮 2 ➡️ score5 💭 scores5 is 0

Here, we are doing some arithmetic operations and storing the results in five different constants.

Instructions

1.

In the code editor, we have already declared and initialized a variable called amount.

Declare a new variable named tip and give it the value of amount multiplied by 0.2.

Note: There are quite a few variations of x’s in the emoji picker. Make sure to use ✖️.

2.

Use string interpolation to print a message that says:

The tip is $[tip]

Where [tip] is the value of the tip constant.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Already have an account?