WEBVTT 1 00:00:01.730 --> 00:00:05.512 So in the previous video we started looking at the if statement and 2 00:00:05.512 --> 00:00:08.150 went through various conditional checks. 3 00:00:08.150 --> 00:00:12.490 So we actually looked at the if, the else, the elif and come up with 4 00:00:12.490 --> 00:00:16.300 a simple scenario so you can see on the screen a simple guess the number game. 5 00:00:16.300 --> 00:00:20.370 But what I want to talk about now is the situation where you want to test more 6 00:00:20.370 --> 00:00:23.540 complicated conditions than the simple ones we've used so far. 7 00:00:23.540 --> 00:00:26.470 And Python actually gives you the mechanism to produce quite 8 00:00:26.470 --> 00:00:29.360 complex expressions when you're actually doing some testing. 9 00:00:29.360 --> 00:00:33.210 So what I'm going to do is delete this code now, and start fresh. 10 00:00:33.210 --> 00:00:34.570 And let's come up with a scenario. 11 00:00:34.570 --> 00:00:37.040 So we'll type in age equals input. 12 00:00:38.800 --> 00:00:39.950 Actually we'll put an int there first. 13 00:00:39.950 --> 00:00:42.620 So int input, so we're converting it to a number. 14 00:00:42.620 --> 00:00:43.789 How old are you? 15 00:00:46.244 --> 00:00:50.070 So what we can do is put, if age greater than equal to 16. 16 00:00:50.070 --> 00:00:52.670 You've seen something similar to that before. 17 00:00:52.670 --> 00:00:56.510 We had talked about the greater than equal operator in the previous video. 18 00:00:56.510 --> 00:01:02.359 But we can also expand that, we can put int space age, less than equal to 65. 19 00:01:03.660 --> 00:01:08.180 So what that does, that actually checks to see whether the age is greater than or 20 00:01:08.180 --> 00:01:12.120 equal to 16 and that it's also less than and equal to 65. 21 00:01:12.120 --> 00:01:14.885 So if we actually do that and then we should do a print, 22 00:01:14.885 --> 00:01:18.830 have a good day at work. 23 00:01:18.830 --> 00:01:22.454 So obviously run that. 24 00:01:22.454 --> 00:01:25.200 How old are you? 25 00:01:25.200 --> 00:01:26.310 We can actually enter our value. 26 00:01:26.310 --> 00:01:27.910 Add 9. We put 15. 27 00:01:27.910 --> 00:01:31.930 Nothing happens, and that's because this condition wasn't fulfilled. 28 00:01:31.930 --> 00:01:34.926 Because age was 15, which failed this first part here, so 29 00:01:34.926 --> 00:01:36.645 consequently nothing happened. 30 00:01:36.645 --> 00:01:37.745 So if we run it again. 31 00:01:37.745 --> 00:01:38.885 This time I'll put, say 25. 32 00:01:38.885 --> 00:01:41.045 Have a good day at work. 33 00:01:41.045 --> 00:01:45.875 So, it's looking for a number that's within the ranges of greater than or 34 00:01:45.875 --> 00:01:48.330 equal to 16 and less than equal to 65. 35 00:01:48.330 --> 00:01:52.920 Now because the and has a lower priority than the conditional operators, 36 00:01:52.920 --> 00:01:54.870 this expression evaluates as we would expect. 37 00:01:54.870 --> 00:01:58.450 But if you want to be really clear you can use parentheses to make it 38 00:01:58.450 --> 00:01:59.540 obvious what you intended. 39 00:01:59.540 --> 00:02:01.620 So what we could have done is something like this. 40 00:02:01.620 --> 00:02:04.988 We could have actually changed this, used brackets. 41 00:02:08.377 --> 00:02:10.770 Like so, and we've made it very clear. 42 00:02:10.770 --> 00:02:12.480 And we'll still get the same result. 43 00:02:12.480 --> 00:02:15.130 But it's now a lot clearer because I've used those brackets what we 44 00:02:15.130 --> 00:02:15.740 were trying to do. 45 00:02:15.740 --> 00:02:18.920 It still actually works as you can see. 46 00:02:18.920 --> 00:02:23.090 So the parentheses just to be clear aren't necessary, but generally speaking, 47 00:02:23.090 --> 00:02:27.320 it's a good idea to use them, especially in complex conditional expressions. 48 00:02:27.320 --> 00:02:30.060 And the reason that you want to do that is it really makes it, 49 00:02:30.060 --> 00:02:35.430 not only does it make it easy to read, but if someone has to work on your code later, 50 00:02:35.430 --> 00:02:38.650 the use of parentheses makes it obvious to them what your intentions were. 51 00:02:38.650 --> 00:02:42.590 So for that reason, I certainly highly recommend brackets or parentheses. 52 00:02:42.590 --> 00:02:44.640 Now Python also gives you another scenario. 53 00:02:44.640 --> 00:02:46.790 Instead of writing it the way we've written there. 54 00:02:46.790 --> 00:02:47.690 We can comment that out. 55 00:02:47.690 --> 00:02:50.020 And we'll comment out just that one line. 56 00:02:51.340 --> 00:02:52.590 And we can also do it like this. 57 00:02:52.590 --> 00:03:00.010 We can put if 16, less than equal to age, less than equal to 65. 58 00:03:00.010 --> 00:03:02.370 Which is another way of actually writing the thing, the same thing. 59 00:03:02.370 --> 00:03:07.890 So we can actually do, on that and just confirm if it's working. 60 00:03:07.890 --> 00:03:11.660 We didn't get a message because we're outside of the range, and 34, 61 00:03:11.660 --> 00:03:13.540 we have gotten a message. 62 00:03:13.540 --> 00:03:17.550 So you can see, there we're actually doing a test to see whether the value 16 is less 63 00:03:17.550 --> 00:03:22.510 than equal to age, and whether the value 65 is less than equal to age as well. 64 00:03:22.510 --> 00:03:25.140 Making sure that it's actually within the range that's been entered. 65 00:03:25.140 --> 00:03:27.680 And there's actually even an easier way that we could write this. 66 00:03:27.680 --> 00:03:30.560 Instead of using less than equal, we can actually change this and 67 00:03:30.560 --> 00:03:33.160 put 15 less than age and less than 66. 68 00:03:33.160 --> 00:03:38.990 So what we could do there is we could actually run that. 69 00:03:38.990 --> 00:03:40.100 How old are you if we're 15? 70 00:03:40.100 --> 00:03:43.990 We don't get a message because the range was greater than or 71 00:03:43.990 --> 00:03:46.450 equal to 16 originally and less than 65. 72 00:03:46.450 --> 00:03:47.640 Less than equal to 65. 73 00:03:47.640 --> 00:03:51.880 If we put the age of 16, have a good day at work. 74 00:03:51.880 --> 00:03:56.860 So that's still actually working because age is not less than 15 in this case and 75 00:03:56.860 --> 00:03:58.080 we can actually change it again. 76 00:03:59.110 --> 00:04:01.220 We can put 61 or 62, have a good day at work, and 77 00:04:01.220 --> 00:04:06.500 lastly 66 actually falls outside of the range. 78 00:04:06.500 --> 00:04:09.940 So that's possibly easy to understand as well. 79 00:04:09.940 --> 00:04:12.801 So the other thing we can do is we can actually turn the condition around using 80 00:04:12.801 --> 00:04:15.590 an or instead, so I'm just gonna go ahead and do that. 81 00:04:15.590 --> 00:04:17.775 Let's actually just comment out all this code, so 82 00:04:17.775 --> 00:04:20.750 I've just got the original age and put at the top which is the same. 83 00:04:20.750 --> 00:04:26.930 When you put something like if age is less than 16 or 84 00:04:26.930 --> 00:04:30.650 age is greater than 65, 85 00:04:30.650 --> 00:04:35.340 print, enjoy your free time. 86 00:04:38.080 --> 00:04:42.610 Else, print, have a good day at work. 87 00:04:42.610 --> 00:04:47.110 So you can see what we've done there, we've actually use an or to check whether 88 00:04:47.110 --> 00:04:52.790 the age is less than 16 or it's greater than 65 so if either of those expressions 89 00:04:52.790 --> 00:04:56.840 turns out being true, this message is gonna be printed, enjoy your free time. 90 00:04:56.840 --> 00:04:59.540 Otherwise the else is gonna be invoked and we should see the message, 91 00:04:59.540 --> 00:05:00.600 have a good day at work. 92 00:05:00.600 --> 00:05:01.840 So if you actually run that. 93 00:05:01.840 --> 00:05:04.170 I'll just stop this and start this again. 94 00:05:04.170 --> 00:05:07.340 How old are you? So if I put 15, enjoy your free time. 95 00:05:07.340 --> 00:05:08.070 Run it again. 96 00:05:08.070 --> 00:05:10.980 And if I put 66, enjoy your free time. 97 00:05:10.980 --> 00:05:15.190 And if I put a value in between 45, have a good day at work. 98 00:05:15.190 --> 00:05:17.130 So that's using an or. 99 00:05:17.130 --> 00:05:20.510 And again the difference there was with an end, with this line up here. 100 00:05:20.510 --> 00:05:21.980 Both conditions have to be true, 101 00:05:21.980 --> 00:05:26.510 so both what was in the parentheses had to actually equate to true, for 102 00:05:26.510 --> 00:05:30.460 that condition to be satisfied, but in the case of or, it's either, has to be. 103 00:05:30.460 --> 00:05:34.110 So we're checking here to see if the age is less than 16 or 104 00:05:34.110 --> 00:05:35.820 if it's greater than 65. 105 00:05:35.820 --> 00:05:38.400 If either of those expressions turns out to be true 106 00:05:38.400 --> 00:05:40.280 then the message on the next line is printed. 107 00:05:40.280 --> 00:05:43.730 There's one important difference though to actually using and and or. 108 00:05:43.730 --> 00:05:45.050 When comparing conditions using and 109 00:05:45.050 --> 00:05:49.120 Python is gonna stop checking as soon as it finds a condition that's false. 110 00:05:49.120 --> 00:05:51.250 Whereas comparing conditions using or, 111 00:05:51.250 --> 00:05:54.520 it's going to stop as soon as it finds one that's true. 112 00:05:54.520 --> 00:05:58.970 So again in this case here, with the and, if age wasn't greater than or 113 00:05:58.970 --> 00:06:00.440 equal to 16 it wouldn't do anything else. 114 00:06:00.440 --> 00:06:02.270 At that point that was going to be a false. 115 00:06:02.270 --> 00:06:06.690 If i just say 15 in our test it would stop and it wouldn't actually start doing this 116 00:06:06.690 --> 00:06:10.600 sort of doing this expression because the other ones has already been proved to be 117 00:06:10.600 --> 00:06:14.260 false but with an or we're looking to one of these to be true. 118 00:06:14.260 --> 00:06:18.720 So, if age is less than 16, so again 15 was entered and 119 00:06:18.720 --> 00:06:22.470 this expression is going to be true because 15 is less than 16. 120 00:06:22.470 --> 00:06:26.940 Only if that is false, so if say 25 was typed in, only then will the or 121 00:06:26.940 --> 00:06:30.460 be actually checked to see whether the age was also greater than 65. 122 00:06:30.460 --> 00:06:33.150 So that's the important difference between both. 123 00:06:33.150 --> 00:06:37.630 And just as an example, if we type if, 124 00:06:37.630 --> 00:06:45.190 we'll go back here actually, start at the right indent level, 125 00:06:45.190 --> 00:06:50.790 if some condition, or, some weird function, 126 00:06:50.790 --> 00:06:55.000 that does stuff hash do something. 127 00:06:56.820 --> 00:06:59.780 So this example here which obviously is not working because we haven't set these 128 00:06:59.780 --> 00:07:02.560 things up, some condition evaluates to true. 129 00:07:02.560 --> 00:07:04.310 If that happens there's no need for 130 00:07:04.310 --> 00:07:08.200 Python to execute the weird function before deciding whether to do something. 131 00:07:08.200 --> 00:07:11.470 So basically this can be very important when we come to looking at classes but for 132 00:07:11.470 --> 00:07:15.140 now it's just something to be aware of, checking to see this first part, 133 00:07:15.140 --> 00:07:17.870 whether that's gonna be executed based on the actual value. 134 00:07:17.870 --> 00:07:20.690 Now, Python, itself, doesn't have a boolean data type. 135 00:07:20.690 --> 00:07:22.490 And in other languages, Java for 136 00:07:22.490 --> 00:07:26.730 example, there is a boolean data type which you can set to true or false. 137 00:07:26.730 --> 00:07:29.940 But what it does have, it has two constants, true and false. 138 00:07:29.940 --> 00:07:32.410 So as well as conditions evaluating to true or false, 139 00:07:32.410 --> 00:07:36.260 just about anything in Python can also be tested in a condition. 140 00:07:36.260 --> 00:07:38.250 And this can actually lead to some strange results and 141 00:07:38.250 --> 00:07:39.210 I'm gonna show you what I mean here. 142 00:07:39.210 --> 00:07:43.930 So I'm gonna delete this code and I'm gonna put x equals false. 143 00:07:43.930 --> 00:07:44.846 X being a string. 144 00:07:44.846 --> 00:07:50.116 If x, print. 145 00:07:50.116 --> 00:07:51.530 X is true. 146 00:07:51.530 --> 00:07:53.780 Now if we actually run that. 147 00:07:55.020 --> 00:07:56.130 Comes back with x is true. 148 00:07:56.130 --> 00:07:57.730 Now that may not have been what you expected. 149 00:07:57.730 --> 00:07:59.110 Perhaps you've looked at this and 150 00:07:59.110 --> 00:08:02.980 you're wondering why we're showing true when x was set to the value of false. 151 00:08:02.980 --> 00:08:06.070 Well, in Python true is one and false is zero. 152 00:08:06.070 --> 00:08:11.330 But in a condition, any non-zero or non-empty values will evaluate to true. 153 00:08:11.330 --> 00:08:15.800 So because we've actually got the x string set to a value, which in this 154 00:08:15.800 --> 00:08:19.610 case is the value of false, it's going to be evaluated as being returned true. 155 00:08:19.610 --> 00:08:23.950 So if x is actually going to return to and that's why when we run it, 156 00:08:23.950 --> 00:08:25.420 we actually got the line of output. 157 00:08:25.420 --> 00:08:28.340 So, more specifically, anything except the following is gonna be true. 158 00:08:28.340 --> 00:08:30.300 We're going to use the bull function, so 159 00:08:30.300 --> 00:08:32.220 we can print out the results to actually confirm this. 160 00:08:32.220 --> 00:08:34.590 And I'm actually going to copy and paste this code, and paste it in. 161 00:08:34.590 --> 00:08:37.430 And I'm going to paste this in and we're actually going to run it. 162 00:08:39.150 --> 00:08:41.680 And you can see here in these scenarios, when we're going to be finding out more 163 00:08:41.680 --> 00:08:45.300 about these types variables, and basically what I've done is I've just pasted in some 164 00:08:45.300 --> 00:08:48.480 code, and I'll just bring it back to the screen so we can actually read it. 165 00:08:48.480 --> 00:08:50.490 And figured out what the values were for each of them. 166 00:08:50.490 --> 00:08:53.410 So the false, we're setting up the false, if that's the case you can see we've 167 00:08:53.410 --> 00:08:56.775 used a replacement field, and it actually does return false. 168 00:08:56.775 --> 00:09:02.000 Bull for none, none is another dial type in Python that's also set to false. 169 00:09:02.000 --> 00:09:04.890 A zero, so we do it using the bull function to actually check 170 00:09:04.890 --> 00:09:07.320 to see whether this returns a true or false, and 171 00:09:07.320 --> 00:09:10.400 you can see the various things here, whether they return true or false, 172 00:09:10.400 --> 00:09:13.660 in this case everything's returning false because we're checking for empty. 173 00:09:13.660 --> 00:09:17.410 And you probably don't know at this stage what a list is, what a is and 174 00:09:17.410 --> 00:09:18.910 we'll be talking about that more in the future. 175 00:09:18.910 --> 00:09:22.290 But for now it's just something to keep in mind that as we progress through 176 00:09:22.290 --> 00:09:25.680 the definitions that you think might be the case with 177 00:09:25.680 --> 00:09:29.000 as in the true example I gave you may not the case in practice. 178 00:09:29.000 --> 00:09:31.100 But I'll alert you to that as we go through anyway. 179 00:09:31.100 --> 00:09:34.600 And there's one exception to this and it's possible to create a class that evaluates 180 00:09:34.600 --> 00:09:37.960 to false, but there's probably enough confusion without introducing anymore, so 181 00:09:37.960 --> 00:09:39.340 I won't go into that in detail. 182 00:09:39.340 --> 00:09:42.480 What this does, the reason that I brought this up, it does allow you to create 183 00:09:42.480 --> 00:09:46.600 conditions, such as this, so I'm going to actually type in some more code. 184 00:09:46.600 --> 00:09:52.085 So x equals input, please enter some text. 185 00:09:52.085 --> 00:09:58.561 If x, print you entered. 186 00:10:02.028 --> 00:10:07.337 .format, and it's gonna be x, 187 00:10:07.337 --> 00:10:14.010 else print, you did not enter anything. 188 00:10:14.010 --> 00:10:17.790 So if we actually run this, please enter some text. 189 00:10:17.790 --> 00:10:18.640 Or I'll just press enter. 190 00:10:18.640 --> 00:10:20.490 You did not enter anything. 191 00:10:20.490 --> 00:10:26.010 But if I actually enter some text, Tim was here, you entered Tim was here. 192 00:10:26.010 --> 00:10:30.510 So this can actually result in simpler code, but probably at this stage, 193 00:10:30.510 --> 00:10:33.360 I'd recommend you'd avoid it until you're more comfortable with Python. 194 00:10:33.360 --> 00:10:36.390 Now before we actually finish with conditions there's two more key words 195 00:10:36.390 --> 00:10:37.320 that we need to look at. 196 00:10:37.320 --> 00:10:41.210 The first is not which just reverses a true or false value. 197 00:10:41.210 --> 00:10:44.070 Not true equals false and not false equals true. 198 00:10:44.070 --> 00:10:49.753 So for example, we can put print 199 00:10:49.753 --> 00:10:54.820 not false, print not true. 200 00:10:54.820 --> 00:10:55.660 So we actually run that. 201 00:10:56.740 --> 00:10:59.660 You get true for the first one and false for the second one. 202 00:10:59.660 --> 00:11:02.450 So basically it just reverses whatever the count scenario was. 203 00:11:02.450 --> 00:11:06.125 So in this case false would normally return zero, where false is a zero, 204 00:11:06.125 --> 00:11:08.695 as you recall from earlier in this lecture. 205 00:11:08.695 --> 00:11:10.725 Not false is gonna return true. 206 00:11:10.725 --> 00:11:13.315 Likewise, for true, not or the inverse of that is going to be false. 207 00:11:13.315 --> 00:11:18.275 So based on that, what we could have done, if we go back to our earlier voting check. 208 00:11:18.275 --> 00:11:24.495 We could do something like age equals int input, how old are you? 209 00:11:27.380 --> 00:11:34.240 So you can put something like if not age less than 18. 210 00:11:34.240 --> 00:11:35.490 Print. 211 00:11:36.860 --> 00:11:37.990 Not old enough to vote. 212 00:11:40.610 --> 00:11:41.110 Print. 213 00:11:42.740 --> 00:11:46.270 Please put an X in the box. 214 00:11:47.460 --> 00:11:54.220 Else, print, please come back, in 215 00:11:55.750 --> 00:12:01.676 years, and of course it was .format, 18-age. 216 00:12:01.676 --> 00:12:04.980 So if you run that now, how old are you? 217 00:12:04.980 --> 00:12:07.820 If I put in 15, please come back in three years. 218 00:12:07.820 --> 00:12:10.210 That's because it's performing this check now. 219 00:12:10.210 --> 00:12:12.610 If not age less than 18, so 220 00:12:12.610 --> 00:12:17.620 age less than 18 would be true in this case because age was less than 18. 221 00:12:17.620 --> 00:12:20.910 But not is the inverse of that, so the inverse of that would be, 222 00:12:20.910 --> 00:12:25.560 we're looking for an age in this case that is actually 18 or higher. 223 00:12:25.560 --> 00:12:28.500 If not age less than 18, in this case being 15, 224 00:12:28.500 --> 00:12:32.110 and that evaluates effectively as false, and it comes back and 225 00:12:32.110 --> 00:12:35.260 actually shows how old you are, and please come back in three years. 226 00:12:35.260 --> 00:12:38.490 Run that again, we put 21, you're old enough to vote, 227 00:12:38.490 --> 00:12:42.780 and that's because age less than 18 is false and 228 00:12:42.780 --> 00:12:46.540 then not, which is the inverse of that, converts the false to the true and that's 229 00:12:46.540 --> 00:12:49.985 why we can actually see that message showing on the screen for that reason. 230 00:12:49.985 --> 00:12:53.225 So sometimes, and this is not one of them, it makes sense to check for 231 00:12:53.225 --> 00:12:54.965 a condition not being true. 232 00:12:54.965 --> 00:12:56.725 And then not a keyword allows you to do that. 233 00:12:56.725 --> 00:13:00.775 And you'll see more examples of not and so forth as we go through in the actual OS. 234 00:13:00.775 --> 00:13:02.027 We go through the course. 235 00:13:02.027 --> 00:13:04.697 Now in is another keyword and it's used in sequences, 236 00:13:04.697 --> 00:13:07.757 and we make more use of it when we come back to look at lists in a later section, 237 00:13:07.757 --> 00:13:11.637 but one list that we have used though is a string, which is a sequence of characters, 238 00:13:11.637 --> 00:13:13.937 so let's have a look at the in keyword for that. 239 00:13:13.937 --> 00:13:15.747 So we're gonna start with parent, so 240 00:13:15.747 --> 00:13:17.197 what I'll do is I'm just gonna paste this code in. 241 00:13:17.197 --> 00:13:19.730 I'm gonna do that and I'm gonna paste it in. 242 00:13:19.730 --> 00:13:21.490 But, for some reason hasn't pasted it properly. 243 00:13:21.490 --> 00:13:24.640 This is a good example of how sometimes things don't get pasted 244 00:13:24.640 --> 00:13:25.580 in correctly to spaces. 245 00:13:25.580 --> 00:13:27.750 So, you've got to just check your spaces and 246 00:13:27.750 --> 00:13:30.340 your tabs to make sure things have been correctly put in. 247 00:13:30.340 --> 00:13:33.880 And you can see that basically intelliJ is quite happy to tell us that things 248 00:13:33.880 --> 00:13:34.860 aren't correct. 249 00:13:34.860 --> 00:13:37.300 So, you can just go back and delete. 250 00:13:37.300 --> 00:13:40.210 So start like that and then press tab which fixes it. 251 00:13:40.210 --> 00:13:42.720 We could just remove the offending characters. 252 00:13:42.720 --> 00:13:45.780 So again, you find that it's quite common when you're actually copying and 253 00:13:45.780 --> 00:13:49.130 pasting code from other place, and I did allude to that earlier. 254 00:13:49.130 --> 00:13:50.785 It's how I actually go about fixing it. 255 00:13:50.785 --> 00:13:54.535 So in this case, we've set up a string called parent, we're actually looking for 256 00:13:54.535 --> 00:13:57.475 a letter, and if that letter is actually in parent, 257 00:13:57.475 --> 00:14:00.345 in other words if it's contained within the parent stream, 258 00:14:00.345 --> 00:14:04.220 that's what the in keyword does, we can actually print out that message. 259 00:14:04.220 --> 00:14:05.820 Otherwise, I'm gonna say I don't need that letter. 260 00:14:05.820 --> 00:14:09.170 So if I actually run this into a character. 261 00:14:09.170 --> 00:14:11.800 So if we put, o, for example. 262 00:14:11.800 --> 00:14:12.500 Give me an o, Bob. 263 00:14:12.500 --> 00:14:15.890 And that's because if letter, the letter we typed in was o, 264 00:14:15.890 --> 00:14:18.800 if that's in the parent, which it does, that's actually in there. 265 00:14:18.800 --> 00:14:19.500 So that's good. 266 00:14:19.500 --> 00:14:20.500 So that worked. 267 00:14:20.500 --> 00:14:21.280 And we'll just try another one. 268 00:14:21.280 --> 00:14:22.020 We'll try a b. 269 00:14:23.970 --> 00:14:26.820 Now you might be thinking well hang on there's a B there, why didn't that work? 270 00:14:26.820 --> 00:14:29.060 Well, that's because that's a capital B. 271 00:14:29.060 --> 00:14:30.730 Capital B for blue there. 272 00:14:30.730 --> 00:14:35.400 And doing a comparison as far as the N key word is concerned 273 00:14:35.400 --> 00:14:36.570 that letter is different. 274 00:14:36.570 --> 00:14:39.640 So an uppercase B is different to a lowercase b. 275 00:14:39.640 --> 00:14:42.300 If I type the uppercase B, give me a B Bob. 276 00:14:42.300 --> 00:14:43.740 It actually does work. 277 00:14:43.740 --> 00:14:45.780 And also if we enter a letter that's not in there like a z, 278 00:14:46.930 --> 00:14:49.830 I don't need that letter, so it actually comes up quite correctly and 279 00:14:49.830 --> 00:14:51.165 doesn't actually match anything. 280 00:14:51.165 --> 00:14:54.220 Now you can also use a not in that example so we put, 281 00:14:54.220 --> 00:14:59.550 at the moment we put if letter in parent we can actually change that to put if not 282 00:14:59.550 --> 00:15:02.840 in parent then we would have to change the prints around, so go look. 283 00:15:02.840 --> 00:15:07.220 So ready to put the other print here in that scenario 284 00:15:07.220 --> 00:15:10.090 because we're actually doing a not test so we're going to get the reverse results. 285 00:15:10.090 --> 00:15:15.410 So if we actually run this again put z, I don't need that letter, which is correct. 286 00:15:15.410 --> 00:15:20.470 Or if you put a B in, we actually get a correct response. 287 00:15:20.470 --> 00:15:22.410 So that's it. So I'm going to end this video here. 288 00:15:22.410 --> 00:15:25.320 In the next video it's time for your first challenge. 289 00:15:25.320 --> 00:15:30.370 So what I'm going to do is give you a challenge to come up with an answer to and 290 00:15:30.370 --> 00:15:32.130 it's gonna help you understand, or 291 00:15:32.130 --> 00:15:35.180 by actually completing that challenge it's gonna help you understand 292 00:15:35.180 --> 00:15:37.640 what you've learned in this video and the previous video. 293 00:15:37.640 --> 00:15:39.100 So I'll see you in that next video.