All language subtitles for 15. Logical Operators - General Concept

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,420 --> 00:00:03,900 Hello and welcome back to another Alphatech Academy video. 2 00:00:04,500 --> 00:00:05,460 My name is Vlad. 3 00:00:05,580 --> 00:00:09,700 And in this video, we're going to talk about logical operators. 4 00:00:09,900 --> 00:00:15,630 So we use the logical operators in our day to day life without paying much attention to it. 5 00:00:15,750 --> 00:00:22,620 For example, if we can take a slice of bread and some spread, then we can make a delicious sandwich. 6 00:00:22,770 --> 00:00:29,460 Another example, we can say that if it's raining outside or worry it's cold today, then you should 7 00:00:29,460 --> 00:00:31,200 take your jacket with you. 8 00:00:32,010 --> 00:00:38,490 So if we take a look at the first example, we can see that it has basically two, let's call it this 9 00:00:38,490 --> 00:00:40,920 way, to sub conditions. 10 00:00:41,340 --> 00:00:44,580 The first one is if we take a slice of bread. 11 00:00:45,030 --> 00:00:46,410 This is the first condition. 12 00:00:46,830 --> 00:00:54,930 And the second one is if we take some spread and if we want to use some formality here, there are these 13 00:00:54,930 --> 00:00:58,230 two sub conditions are called operands. 14 00:00:58,320 --> 00:01:01,020 So there is the first one and the second one. 15 00:01:01,140 --> 00:01:03,270 And these two sub conditions. 16 00:01:03,300 --> 00:01:11,250 These two operands, basically what they do is they form by using a logical and operator. 17 00:01:11,280 --> 00:01:13,650 They form a new condition. 18 00:01:13,770 --> 00:01:21,540 And this combined condition may also be true or false based on the status on the result of these SAB 19 00:01:21,540 --> 00:01:24,930 condition, based on the result of these two operands. 20 00:01:24,960 --> 00:01:29,690 And they're the and logical operator that we use between them. 21 00:01:29,880 --> 00:01:36,450 And now the question that remains is how can we decide if the result will be true or false? 22 00:01:36,600 --> 00:01:38,300 And for that, we can use a truth. 23 00:01:38,310 --> 00:01:38,790 They will. 24 00:01:38,810 --> 00:01:40,620 That will help us with the decision. 25 00:01:40,770 --> 00:01:43,800 And this truth table is very straightforward. 26 00:01:43,830 --> 00:01:45,060 Once you understand it. 27 00:01:45,300 --> 00:01:51,150 So let's suppose that we have this little nice table with a couple of columns and a couple of rows. 28 00:01:51,480 --> 00:01:57,870 And we will say that the first column will represent the status or the result of the first operand over 29 00:01:57,870 --> 00:02:03,900 the first subcommission, which we took, for example, that it stands for. 30 00:02:04,290 --> 00:02:06,960 If we take a slice of bread. 31 00:02:07,040 --> 00:02:07,320 OK. 32 00:02:07,410 --> 00:02:09,030 So that's the first operand. 33 00:02:09,150 --> 00:02:15,240 And the second column in this truth table will represent the status of the second sub condition of the 34 00:02:15,240 --> 00:02:17,850 second operand, which stands for. 35 00:02:17,970 --> 00:02:19,860 If we take a spread. 36 00:02:19,950 --> 00:02:23,540 So the first condition is if we take a bread, OK. 37 00:02:23,660 --> 00:02:30,450 And the second one, if we take a spread and each of these operands may be either a true or false. 38 00:02:30,490 --> 00:02:35,760 And basically there is a total of four optional combinations between them. 39 00:02:35,980 --> 00:02:42,720 Either both of them are true or maybe one of them is true and the second one is false or both of them 40 00:02:42,840 --> 00:02:43,980 are false. 41 00:02:44,130 --> 00:02:44,630 Let's eat. 42 00:02:44,650 --> 00:02:44,990 Right. 43 00:02:45,210 --> 00:02:48,510 Either both of them are true or the first one is true. 44 00:02:48,510 --> 00:02:51,290 The second one is false or otherwise. 45 00:02:51,300 --> 00:02:56,580 The first one is false and the second one is true, or both of them are false. 46 00:02:56,850 --> 00:03:02,370 There are no other combinations that you can do with these two sub conditions. 47 00:03:02,400 --> 00:03:02,820 All right. 48 00:03:03,510 --> 00:03:08,730 So these were just the operands of our overall expression. 49 00:03:09,060 --> 00:03:15,600 Now, let's see what would be the result of using an and logical operator on both of them. 50 00:03:15,750 --> 00:03:22,860 So if you have a slice of bread and you have a spread, then it means you can make a sandwich. 51 00:03:22,980 --> 00:03:30,150 So it means that if both of these sub conditions are true, then the overall resolved is true. 52 00:03:30,240 --> 00:03:32,130 You can make a sandwich. 53 00:03:32,280 --> 00:03:37,480 But if you don't have at least one of them either, it's a slice of bread, worries bread. 54 00:03:37,830 --> 00:03:40,260 Then you can not make a sandwich. 55 00:03:40,290 --> 00:03:42,910 You will have just one of the ingredients. 56 00:03:42,960 --> 00:03:49,050 But it will be it won't be sufficient to make your favorite sandwich. 57 00:03:49,050 --> 00:03:49,350 Right. 58 00:03:49,680 --> 00:03:57,390 So the overall result in this case is that both of them are going to be false. 59 00:03:57,540 --> 00:04:05,520 And lastly, if there is no bread and no spread, then it is obvious that there is no sandwich. 60 00:04:05,760 --> 00:04:09,420 So the result is definitely going to be false. 61 00:04:09,690 --> 00:04:18,200 Now, what we've done is we've simply created a truth table for the for the and logical operator. 62 00:04:18,330 --> 00:04:25,410 So whenever you're going to work with a and and logical operator and you have a couple of sub conditions, 63 00:04:25,830 --> 00:04:32,820 you can use these Troost, they will to help you understand what will be the result, the overall result 64 00:04:32,820 --> 00:04:34,110 of the condition itself. 65 00:04:34,200 --> 00:04:41,190 So once again, based on the status of the given operands that you can see in these columns, if you 66 00:04:41,190 --> 00:04:48,360 use the logical and operator between the two, then the result is going to be exactly as you can see 67 00:04:48,570 --> 00:04:50,440 on the last column, on the right one. 68 00:04:50,700 --> 00:04:53,240 So I hope that's clear to you guys. 69 00:04:53,270 --> 00:04:55,920 And you understand everything we've just discussed. 70 00:04:56,230 --> 00:04:58,260 And just to make sure that you do. 71 00:04:58,290 --> 00:04:59,910 I'm going to give you another. 72 00:05:00,100 --> 00:05:03,730 Example using the and logical operator. 73 00:05:04,270 --> 00:05:10,360 So let's say that you want to ask for some money from I don't know whom maybe your parents, your friends, 74 00:05:10,360 --> 00:05:12,910 your colleagues or anyone else. 75 00:05:13,060 --> 00:05:19,750 And since you know they care for you, you know they will help you, but they will help you only if 76 00:05:19,750 --> 00:05:23,230 you have less than, let's say, 50 bucks in your wallet. 77 00:05:23,380 --> 00:05:28,210 And also, they will not just give you the money based on that condition alone. 78 00:05:28,750 --> 00:05:31,360 They also want you to succeed in school. 79 00:05:31,390 --> 00:05:39,430 So there is a second condition which says that you have to get a grade higher than 90 on your programming 80 00:05:39,440 --> 00:05:39,940 the exam. 81 00:05:40,090 --> 00:05:45,460 And if both of these conditions are satisfied, then you will preened the following message. 82 00:05:45,550 --> 00:05:47,080 Give me some money, please. 83 00:05:47,120 --> 00:05:51,490 I've earned it with a high grade and nothing in my pocket. 84 00:05:53,040 --> 00:05:54,760 So pretty funny example. 85 00:05:54,790 --> 00:05:57,160 But let's try to look more into it. 86 00:05:57,610 --> 00:06:03,100 So this message will be printed only if both of these conditions happen to be true. 87 00:06:03,550 --> 00:06:04,850 So we've won. 88 00:06:05,080 --> 00:06:07,600 We have less than 50 bucks in a wallet. 89 00:06:07,720 --> 00:06:15,550 And two, if we've got a grade higher than 90 on our last exam, only then we would preened this message, 90 00:06:15,670 --> 00:06:18,940 asking for some money in a reward. 91 00:06:19,090 --> 00:06:27,400 So I hope the example is clear to you guys and you understand the logic behind using IM and logical 92 00:06:27,400 --> 00:06:28,180 operator. 93 00:06:28,900 --> 00:06:35,020 And now what I want to do is to talk about the second example, a sentence we probably mentioned at 94 00:06:35,020 --> 00:06:36,940 the beginning of the topic, I guess. 95 00:06:37,450 --> 00:06:42,700 And it goes like this if it's raining outside or it's cold today. 96 00:06:43,000 --> 00:06:44,710 Take your jacket with you. 97 00:06:44,980 --> 00:06:50,530 Let's try to construct to the or a logical operator a table ourselves, shall we? 98 00:06:50,650 --> 00:06:58,390 So first of all, we can say that the first operand, the first sub condition relates to if it's raining 99 00:06:58,390 --> 00:07:04,620 outside and the second one relates to if it's cold today. 100 00:07:04,760 --> 00:07:10,360 And if both of them are true, we can say that we definitely should take the jacket. 101 00:07:10,360 --> 00:07:10,720 Right. 102 00:07:10,760 --> 00:07:16,390 If both of them are true, if it's called and if it's raining, then we should take our A jacket with 103 00:07:16,390 --> 00:07:16,720 us. 104 00:07:16,840 --> 00:07:22,210 We know that if it's raining outside, then it doesn't matter if it's called or not, then we should 105 00:07:22,270 --> 00:07:24,490 also take a jacket with us. 106 00:07:24,970 --> 00:07:33,730 Similarly, we if we know that it's cold outside, then it doesn't matter if it's raining because it's 107 00:07:33,730 --> 00:07:34,960 cold, it's outside. 108 00:07:35,020 --> 00:07:42,100 So meaning that for both of these cases, if one condition, at least one condition happens to be true, 109 00:07:42,130 --> 00:07:44,830 the result is also going to be true. 110 00:07:44,950 --> 00:07:46,960 So we need the jacket with us. 111 00:07:47,110 --> 00:07:55,150 And lastly, only if it's not raining and it's not cold today, only then you don't have to take your 112 00:07:55,150 --> 00:07:56,140 jacket with you. 113 00:07:56,320 --> 00:07:59,140 Meaning the result in this case will be false. 114 00:07:59,200 --> 00:08:00,130 It's not cold. 115 00:08:00,190 --> 00:08:03,860 There is no rain and there is no reason to take the jacket with us. 116 00:08:03,970 --> 00:08:07,110 So that's basically how you create a truth. 117 00:08:07,120 --> 00:08:13,180 They will for the or logical operator and just go over it once again. 118 00:08:13,210 --> 00:08:19,450 If either of the conditions, either of the operands happened to be true, then the overall result will 119 00:08:19,450 --> 00:08:20,110 be true. 120 00:08:20,140 --> 00:08:24,310 And just remember this nice example of the called Arean. 121 00:08:24,490 --> 00:08:32,050 If it's raining example that we use right now and shoot you or shoot, should you not take your jacket 122 00:08:32,050 --> 00:08:32,590 with you? 123 00:08:32,740 --> 00:08:34,170 And that's good guy sound. 124 00:08:34,240 --> 00:08:40,780 Now we know how the logical or operator and the logical and operator, how both of them work. 125 00:08:41,350 --> 00:08:45,250 And now we can simply summarize what we've learned so far. 126 00:08:45,370 --> 00:08:50,470 So we may have a couple of operands, a couple of these sub conditions. 127 00:08:50,500 --> 00:08:57,840 And also we may have some logical operators that are applied on these operands. 128 00:08:58,000 --> 00:09:06,640 And the final result of all of these, let's say, process is decided to be either true or false. 129 00:09:06,690 --> 00:09:13,480 It doesn't matter if it's complicated and it doesn't matter how much operands or logical operators you 130 00:09:13,480 --> 00:09:14,110 may use. 131 00:09:14,290 --> 00:09:18,820 The final result may only be either a true or false. 132 00:09:18,940 --> 00:09:21,870 It also it all comes to these same programming. 133 00:09:21,920 --> 00:09:24,790 OK, eventually that's all we have. 134 00:09:25,120 --> 00:09:28,630 Either a true or false sense, zero or one. 135 00:09:28,720 --> 00:09:30,490 And that's how programming work. 136 00:09:31,090 --> 00:09:38,080 So I hope this structure, their usage of these truth tables is clear to you guys. 137 00:09:38,530 --> 00:09:45,640 And one last thing that I want to talk about in these video is the last logical operator, which is 138 00:09:45,640 --> 00:09:48,400 called the not logical operator. 139 00:09:48,900 --> 00:09:51,220 And the it's the easiest one, actually. 140 00:09:51,850 --> 00:09:58,720 It simply takes some expression and whatever its final result to you, the way it's true or false. 141 00:09:58,990 --> 00:09:59,640 These not. 142 00:09:59,940 --> 00:10:02,930 Rader will return the inverse value. 143 00:10:03,020 --> 00:10:06,350 So we feel is applied on a value that happened to be true. 144 00:10:06,680 --> 00:10:09,080 Then the final result would be false. 145 00:10:09,140 --> 00:10:10,730 And vice versa. 146 00:10:11,150 --> 00:10:13,640 So we'd simply negates the result. 147 00:10:13,790 --> 00:10:20,060 And once again, if this not operator is applied on some expression, which is true, then the final 148 00:10:20,060 --> 00:10:22,820 result is going to be false. 149 00:10:22,970 --> 00:10:29,600 And if it is applied on an expression which happens to be false, then the final result is going to 150 00:10:29,600 --> 00:10:30,830 be true. 151 00:10:30,950 --> 00:10:36,590 So thank you guys for watching your on Alphatech Academy programming course. 152 00:10:36,950 --> 00:10:38,020 My name is Vlad. 153 00:10:38,210 --> 00:10:44,960 And now we can move on to practice logical operators in our programming language. 154 00:10:45,140 --> 00:10:45,980 I'll see you there. 14660

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.