WEBVTT

00:00.760 --> 00:02.920
Okay, now our program is completed.

00:02.920 --> 00:05.080
And now let's execute this once again.

00:05.080 --> 00:05.920
And let's see.

00:06.400 --> 00:12.920
Okay we have Python and then we have Mac changer dot pi dash I.

00:12.920 --> 00:25.440
And it is for example eth zero okay something there is something this here I'm not going to give the

00:25.440 --> 00:26.160
Mac address.

00:26.160 --> 00:27.080
Let's hit enter.

00:27.520 --> 00:32.120
Oh my god I have a big error here okay.

00:32.120 --> 00:33.160
Let's handle this.

00:33.160 --> 00:36.960
Let's use decision making okay.

00:37.480 --> 00:42.440
So if someone not enter the interface or not enter the Mac address.

00:42.440 --> 00:45.560
So we don't need to see this part okay.

00:45.560 --> 00:48.560
We don't need to see a lot of things here.

00:48.880 --> 00:55.160
It is better to print a readable text here that please enter the Mac address.

00:55.160 --> 00:57.480
Or please enter the interface.

00:57.840 --> 00:59.000
So how can we do that.

00:59.000 --> 01:01.970
Let's come here and just imagine.

01:01.970 --> 01:03.170
I don't know how to do it.

01:03.370 --> 01:06.730
Let's come here and ask ChatGPT if for help.

01:06.770 --> 01:07.490
Okay.

01:07.530 --> 01:14.450
And here I'm going to say how to how to make a decision.

01:16.490 --> 01:19.010
How to make a decision.

01:19.010 --> 01:21.970
How to use decision making okay.

01:22.010 --> 01:23.090
How to use.

01:25.330 --> 01:29.850
Decision making in Python.

01:31.090 --> 01:35.850
And now let's see what is it going to tell me okay.

01:35.890 --> 01:41.450
Decision making in Python can be used if and else I think.

01:46.530 --> 01:46.890
Wow.

01:46.890 --> 01:50.010
It gives me a lot of examples.

01:50.010 --> 01:55.210
It gives me a lot of thing here that that could help me to do this.

01:55.210 --> 01:55.930
Okay.

01:55.930 --> 02:00.550
So now I have to tell you the summary of this thing that ChatGPT gave me.

02:00.550 --> 02:03.350
Okay, so we can make decision.

02:03.350 --> 02:08.390
We can use decision making in Python using if condition and else condition or Elif condition.

02:08.430 --> 02:08.830
Okay.

02:09.190 --> 02:15.790
So as you see here, we have the get argument here that is responsible for that okay.

02:15.790 --> 02:17.430
And for doing this.

02:17.670 --> 02:24.350
So if I want to do that here I have to move this back okay I will ctrl x that.

02:24.350 --> 02:27.790
And then instead of returning I need to use it here.

02:32.310 --> 02:34.230
Right here instead of return.

02:35.310 --> 02:36.630
So good.

02:36.830 --> 02:43.870
And here I need to use if and else if condition to handle this okay.

02:43.910 --> 02:47.430
So let's use if not okay.

02:47.470 --> 02:57.110
Options dot we had Mac address okay new Mac then let's print.

02:57.110 --> 03:01.800
Sprint, sprint or we have a parser.

03:01.800 --> 03:03.520
We're using parser here.

03:03.720 --> 03:06.320
So here I can use parser.

03:08.600 --> 03:10.040
Dot error.

03:10.160 --> 03:13.200
So it has a part that's called error.

03:13.200 --> 03:14.960
It has a function actually.

03:15.320 --> 03:19.600
And here I am going to give that error message here.

03:19.640 --> 03:24.520
For example it is going to be please specify.

03:26.960 --> 03:37.000
An interface for help or for more help or for help use dash dash help.

03:38.000 --> 03:40.040
Okay, so it is the if part.

03:40.080 --> 03:44.520
And also we have another option that is uh interface.

03:45.000 --> 03:45.760
Okay.

03:45.800 --> 03:48.120
Or here we could use interface.

03:48.120 --> 03:52.640
And in here as you see I use Mac address.

03:52.640 --> 03:58.580
So it is going to be interface Because that takes the messages for interface.

03:59.220 --> 04:09.020
And here we're going to use the Lf not options dot new Mac.

04:10.300 --> 04:11.500
Here let's print.

04:11.540 --> 04:15.020
Do not print use parser dot error.

04:16.660 --> 04:18.460
And here let's.

04:21.780 --> 04:22.620
Use.

04:22.660 --> 04:25.180
Please specify.

04:28.020 --> 04:34.540
Please specify the new Mac address.

04:36.580 --> 04:37.940
Or for help.

04:40.180 --> 04:42.540
Use dash dash L.

04:42.860 --> 04:45.500
Okay, now we have this all here.

04:45.500 --> 04:47.780
And here is the last option.

04:48.540 --> 04:54.300
If not, if someone provide interface and provide the Mac address.

04:54.630 --> 04:59.270
So here we need to do other thing that is the return option.

05:01.070 --> 05:01.750
Options.

05:02.190 --> 05:03.310
Why not argument.

05:03.310 --> 05:06.510
Because down here we are not going to use from argument.

05:06.510 --> 05:08.590
We're only using options.

05:08.870 --> 05:13.190
And here I am telling that options is equal to this.

05:13.190 --> 05:14.510
And here we are using it.

05:14.550 --> 05:15.550
Now save it.

05:16.510 --> 05:18.470
Let's come here back.

05:18.510 --> 05:23.310
And right now you see I am just providing interface and not the Mac address.

05:23.350 --> 05:30.510
Hit enter and okay I have an error on line eight.

05:30.550 --> 05:31.430
Okay.

05:31.430 --> 05:32.990
Invalid syntax.

05:37.470 --> 05:39.510
On line eight, this is the line eight.

05:39.910 --> 05:43.270
So as you see, I have forgotten to give the assignment.

05:43.270 --> 05:43.550
Okay.

05:43.590 --> 05:43.990
Here.

05:44.750 --> 05:45.350
Save it.

05:48.230 --> 05:50.750
And let's re-execute the program.

05:52.550 --> 05:54.450
As you see this time it is telling.

05:54.450 --> 06:04.130
Please specify new Mac address and if I not specify the interface and dash m for example 0011.

06:10.570 --> 06:13.570
Okay, this time it is telling me to provide the interface.

06:15.210 --> 06:21.650
If I just provide dash I and it is eth0.

06:23.770 --> 06:30.250
And now if I hit enter operation not permitted, no problem because I haven't used sudo.

06:35.370 --> 06:36.130
Okay.

06:37.210 --> 06:41.730
And you see nothing happened and means no error here.

06:41.890 --> 06:43.730
That means it has happened successfully.

06:43.810 --> 06:49.890
Okay, so thanks for watching and I'm so glad that you finished this part.

06:50.410 --> 06:53.090
See you in the next section.
