Solution Review: Using Multiple Operators

In the following lesson, we will go over the solution of the challenge: Using Multiple Operators.

We'll cover the following

Task

In this challenge, you were provided with a variable that stored a number and you were asked to check if the number lies between 8 and 75, inclusive of 8.

In other words, check >= 8 and check < 75.

Solution

Let’s look at how we should go about this.

  • The first thing was to make sure check was less than 75.
check < 75
  • Next, we had to make sure that check was also greater than or equal to 8.
check >= 8
  • The last step is simply combining both conditions using the && operator.
check < 75 && check >= 8

You can find the complete solution below:

You were required to write the code on line 2.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy