WEBVTT

00:00.080 --> 00:01.080
Welcome back.

00:01.120 --> 00:03.560
We learned about arithmetic operators.

00:03.600 --> 00:08.280
Now let's move to the second type of operators called comparison.

00:08.320 --> 00:13.840
Those operators return a boolean either true or false.

00:13.960 --> 00:17.840
For example we have this double equal sign.

00:17.880 --> 00:21.000
Equal meaning equals two five.

00:21.040 --> 00:22.600
Is it equal to five?

00:22.640 --> 00:23.400
Yes.

00:23.440 --> 00:25.200
The result would be true.

00:25.240 --> 00:32.960
We have another comparison operator which is this exclamation mark followed by the equals sign.

00:33.000 --> 00:35.920
This means that it's not equal to.

00:35.960 --> 00:36.640
So five.

00:36.680 --> 00:38.960
Is it not equal to three?

00:39.000 --> 00:39.640
Yes.

00:39.960 --> 00:40.960
So it's true.

00:41.080 --> 00:43.440
This is the greater than sign.

00:43.480 --> 00:43.840
Five.

00:43.880 --> 00:44.920
Greater than three.

00:44.960 --> 00:45.520
Yes.

00:45.640 --> 00:46.480
It will return.

00:46.480 --> 00:46.920
True.

00:46.960 --> 00:48.560
The less than five.

00:48.600 --> 00:49.760
Less than three.

00:49.960 --> 00:51.760
It returns false.

00:51.800 --> 00:54.320
Greater than or equal five.

00:54.360 --> 00:56.400
Greater than or equal to five.

00:56.520 --> 00:57.200
Yes.

00:57.200 --> 00:57.760
True.

00:57.800 --> 00:58.520
Return.

00:58.520 --> 00:58.960
True.

00:59.120 --> 01:01.640
And less than or equal five.

01:01.680 --> 01:03.360
Less than or equal to six.

01:03.360 --> 01:04.880
It returns true.

01:04.920 --> 01:08.090
We have two variables x and y.

01:08.130 --> 01:11.450
X equals to ten, y equals to 20.

01:11.530 --> 01:14.930
Let's run this code and here we go.

01:15.090 --> 01:19.210
For the first operation x is equal to y.

01:19.370 --> 01:23.490
Know it returns false x doesn't equal to y.

01:23.690 --> 01:25.570
Yes it returns true.

01:25.730 --> 01:29.850
This is true x greater than y ten.

01:30.010 --> 01:31.210
Greater than 20.

01:31.250 --> 01:34.610
No it returns false x less than y.

01:34.930 --> 01:36.530
It returns true.

01:36.770 --> 01:41.490
So those are the comparison operators.

01:41.610 --> 01:44.650
Let's move to the logical operators.

01:44.650 --> 01:45.450
We have.

01:45.690 --> 01:50.330
Uh, we have and or and not operators.

01:50.570 --> 01:55.210
Those operators are used to combine conditional statements.

01:55.210 --> 02:05.370
For example we have and meaning and x greater than five and y greater less than 30.

02:05.490 --> 02:06.130
Yes.

02:06.250 --> 02:11.290
True or x greater than five or y less than ten.

02:11.330 --> 02:17.180
It returns true not reverses, not x greater than y.

02:17.340 --> 02:18.540
It returns false.

02:18.740 --> 02:28.020
And for better understanding, let me show you again guys, that x equals to ten and y equals to 20.

02:28.220 --> 02:38.580
Copy it and let me paste it here again guys let me run this cell x equal to ten y equals to 20.

02:38.580 --> 02:39.340
Print.

02:39.380 --> 02:42.380
We have this expression.

02:42.380 --> 02:46.140
It's of two parts x greater than five.

02:46.380 --> 02:49.740
Yes it is true y less than 30.

02:49.900 --> 02:50.740
Yes.

02:50.940 --> 02:55.060
So true and true equals true.

02:55.340 --> 02:56.940
So this true.

02:57.180 --> 03:04.260
And this end operator evaluate between a true and a true it returns true.

03:04.260 --> 03:07.500
Another example x greater than five.

03:07.660 --> 03:11.340
Yes it's true or y less than 20.

03:11.380 --> 03:16.700
No it's false but true or false returns true.

03:16.700 --> 03:18.140
So this is the logic.

03:18.340 --> 03:20.380
This is the logical operators.

03:20.620 --> 03:21.740
True and true.

03:21.900 --> 03:22.460
Returns.

03:22.460 --> 03:22.860
True.

03:23.100 --> 03:25.260
True or false.

03:25.300 --> 03:26.900
Returns true.

03:26.940 --> 03:28.180
True or true.

03:28.220 --> 03:29.660
Returns true.

03:29.780 --> 03:31.980
Not x greater than five.

03:32.020 --> 03:33.620
X greater than five.

03:33.860 --> 03:35.900
It's true, not the true.

03:36.140 --> 03:37.740
It returns false.

03:37.740 --> 03:41.100
So it reverses the result.

03:41.100 --> 03:46.220
So and returns true if both statements are true.

03:46.420 --> 03:57.340
So if this side and this side both statements are true, it returns true x greater than five and y less

03:57.340 --> 03:58.100
than ten.

03:58.300 --> 04:07.100
The or operator returns true if one of the statements is true, not reverses the result.

04:07.140 --> 04:10.580
Returns false if the result is true.

04:10.780 --> 04:13.820
So if it is true, it returns false.

04:13.860 --> 04:21.100
Okay, so those are the basic operators that we're going to use in our course.

04:21.100 --> 04:27.220
There are a lot of other operators but we are interested in those operators.
