WEBVTT

00:00.170 --> 00:00.800
Hello guys.

00:00.800 --> 00:02.990
So we are going to continue the discussion with respect to Python.

00:02.990 --> 00:07.850
And in this video we are going to see some amazing real world examples using list in Python.

00:07.880 --> 00:10.580
Now guys, you may be using a lot of applications.

00:10.580 --> 00:14.270
You may be using lot of apps, you know some or the other way.

00:14.270 --> 00:18.530
There are many, many smaller modules where specifically list can be used.

00:18.530 --> 00:21.620
So over here I'll be showing you some of the examples.

00:21.620 --> 00:21.920
Yes.

00:21.920 --> 00:26.450
We are not going to develop a complete end to end project like kind of thing, but it's more about understanding

00:26.450 --> 00:31.040
what applications specifically this kind of data structures list is used.

00:31.070 --> 00:36.020
Okay, so the first example that I'm actually going to do is something called as manager to do list.

00:36.050 --> 00:36.290
Right.

00:36.320 --> 00:42.860
So we will try to create a list which will keep the task track of all the tasks that you are planning

00:42.890 --> 00:43.340
to do.

00:43.370 --> 00:43.940
Okay.

00:43.940 --> 00:49.520
So let's say uh, I will just go ahead and create a variable to do list okay.

00:49.520 --> 00:55.730
And inside this let's say today my task is I have opened my app and I have probably selected okay.

00:55.760 --> 00:57.440
Today I need to buy groceries.

00:57.470 --> 01:00.400
Let's say I need to buy groceries.

01:00.430 --> 01:04.240
The second task that I really want to do is that clean the house.

01:04.480 --> 01:04.900
Okay.

01:04.930 --> 01:06.220
Which is necessary.

01:06.400 --> 01:07.840
Clean the house.

01:08.290 --> 01:14.050
And let's say the third task that I have is something called as pay bills right now.

01:15.070 --> 01:21.760
Uh, let's say after some time, I had to get some kind of task, I had to I got some more task, and

01:21.760 --> 01:24.700
now I want to add that particular task to my to do list.

01:24.730 --> 01:27.370
So right now in the to do list is already a list.

01:27.370 --> 01:32.320
So we know some of the inbuilt methods that we have already discussed, like how we can make sure that

01:32.350 --> 01:35.290
how we can add more tasks in our plate.

01:35.320 --> 01:35.590
Right.

01:35.620 --> 01:39.700
So what I will do, I will just go ahead and use this to do list dot append.

01:39.730 --> 01:40.540
Right.

01:40.540 --> 01:45.460
And inside this append I can probably go ahead and say okay, schedule meeting is one of my tasks.

01:45.460 --> 01:48.010
I need to schedule a specific meeting with someone.

01:48.130 --> 01:50.500
Okay, so this can be one of our task.

01:50.500 --> 01:57.100
And after finishing my work, let's say I want to go to a run, you know, so I will go ahead and append

01:57.130 --> 01:58.600
another task over here.

01:58.600 --> 02:00.730
Something like go for a run.

02:00.760 --> 02:04.000
Okay, go for a run.

02:04.480 --> 02:07.660
Okay, so this is my another task that I really want to do.

02:07.690 --> 02:12.820
Let's say that I have done out of all this task, I have started my day.

02:12.820 --> 02:16.090
And the first task that I have actually done is clean my house.

02:16.120 --> 02:22.090
Okay, so what I will do is that after I probably in my app, you know, after I complete this particular

02:22.090 --> 02:24.760
task, I will make sure to remove that particular task.

02:24.760 --> 02:32.980
And once I removed write a completed task in the back end, what kind of what kind of code will be written,

02:33.010 --> 02:33.280
you know?

02:33.310 --> 02:38.680
So from my to do list, right, which will be in the session, we'll talk more about session and all.

02:38.710 --> 02:43.720
I will just go ahead and remove, uh, clean the house task over here.

02:43.720 --> 02:48.940
So I will just go ahead and copy this entire thing, and I will just go and say, hey, this is completed.

02:48.940 --> 02:57.280
So please remove this particular task from my list, you know, and then, uh, let's go ahead and check.

02:57.310 --> 02:57.520
Okay.

02:57.580 --> 03:00.430
Whether this particular task after removing it is present or not.

03:00.460 --> 03:06.700
So here I will say checking if a task is in the list.

03:06.730 --> 03:07.270
Okay.

03:07.510 --> 03:13.720
And here I'll say hey, if let's say pay bills is there okay.

03:13.750 --> 03:14.530
Pay bills.

03:14.560 --> 03:16.090
Is there in the task.

03:16.120 --> 03:16.750
Okay.

03:16.780 --> 03:19.480
In two underscore do list.

03:19.510 --> 03:21.850
Then I will say print.

03:22.210 --> 03:24.130
I'll send a reminder for me.

03:24.160 --> 03:33.340
Hey don't forget forget to pay the utility bills.

03:33.370 --> 03:35.290
Let's say this is my utility bill.

03:35.320 --> 03:36.100
Okay.

03:36.220 --> 03:37.270
Utility bills.

03:37.300 --> 03:40.480
Okay, so this is just like a reminder that I'm actually getting.

03:40.480 --> 03:46.420
And let's say after finishing all the work, how many tasks I really want to probably, uh, how many

03:46.420 --> 03:48.070
tasks are remaining if I want to print it.

03:48.070 --> 03:48.400
Right.

03:48.400 --> 03:50.020
So I'll just go ahead and write.

03:50.020 --> 03:50.890
Print.

03:51.130 --> 03:56.020
This is my to do list that are remaining to do list remaining.

03:56.020 --> 04:05.180
And I will just go ahead and print for task in my to do list print.

04:05.300 --> 04:08.510
Let's go ahead and print with the help of F string.

04:08.690 --> 04:15.770
F is basically a formatting string, and this will just go ahead and display my task right now.

04:15.800 --> 04:18.410
Obviously I'll be able to see that from my task list.

04:18.410 --> 04:18.770
Clean.

04:18.770 --> 04:21.350
The house should not be there and I should have this.

04:21.350 --> 04:23.810
Both the tasks that should be appended in my to do list.

04:23.840 --> 04:25.190
So let me just go ahead and execute it.

04:25.190 --> 04:29.930
So here you can see, hey, don't forget to pay the utility bills because I got a reminder reminder

04:29.930 --> 04:31.190
saying that over there.

04:31.190 --> 04:33.860
Because pay bills is still there in my to do list.

04:33.860 --> 04:39.170
Then the remaining to do list that are remaining that are like buy groceries, pay bills, schedule

04:39.170 --> 04:40.580
a meeting, go for a run.

04:40.580 --> 04:41.060
Right.

04:41.060 --> 04:46.820
So all this specific things are there and I will be able to keep a track of it so extensively.

04:46.820 --> 04:52.100
I know in a bigger application you'll be seeing that a to do list specifically uses list, because with

04:52.100 --> 04:53.870
the help of list you can actually remove it.

04:53.870 --> 04:58.610
You can add it, you can append a new task over there and everything can be created through it, right?

04:58.610 --> 05:03.380
So whichever programming languages you specifically go ahead with, list will be a common data structure

05:03.380 --> 05:05.030
that will be used extensively.

05:05.060 --> 05:05.570
Okay.

05:05.600 --> 05:08.150
Now let's go ahead and see another example.

05:08.180 --> 05:12.560
So here you have something called as organizing student grades okay.

05:12.560 --> 05:17.090
And now I will just go ahead and copy and paste it over here a code for you.

05:17.120 --> 05:19.970
So here you can see organizing student grades.

05:19.970 --> 05:24.110
So I have some grades over here 85 9278 9088.

05:24.110 --> 05:25.910
So I am adding a new grade.

05:25.910 --> 05:27.500
Let's say new grade has actually come.

05:27.500 --> 05:30.410
So I'll go ahead and append a grade inside this.

05:30.410 --> 05:32.660
Then we'll go ahead and calculate the average grade.

05:32.660 --> 05:34.790
So this is my average grade fine.

05:34.790 --> 05:40.520
The highest and the lowest grade let's say by using inbuilt function like max or grades I'll be able

05:40.520 --> 05:43.880
to get the highest grade and another inbuilt function by min.

05:43.880 --> 05:45.200
I'll be able to get the lowest grade.

05:45.200 --> 05:48.290
So this is how I will be able to see my highest and lowest grade.

05:48.320 --> 05:48.830
Right?

05:48.890 --> 05:50.900
So such a simple example.

05:50.900 --> 05:54.230
But here you can also see that extensively list is basically used.

05:54.230 --> 05:56.890
and just by using this inbuilt function like some.

05:56.890 --> 05:57.340
Right.

05:57.340 --> 06:02.770
Which will get basically get applied in a collection, specifically in a list right over here, you'll

06:02.800 --> 06:07.510
be able to see that I'm able to calculate sum of grades, length of grades, and then I'm able to calculate

06:07.510 --> 06:08.170
the average one.

06:08.200 --> 06:08.380
Right.

06:08.410 --> 06:12.550
So this is another one example with respect to organizing student grades.

06:12.550 --> 06:16.840
And here you can see average grade is so much highest grade is so much lowest grade is so much.

06:16.840 --> 06:20.830
So that is what I'm actually doing to calculate the average of the students okay.

06:20.950 --> 06:24.880
Now one more example that I've actually taken is managing an inventory.

06:24.910 --> 06:25.210
Okay.

06:25.240 --> 06:29.650
So managing an inventory basically means I'm trying to just manage an inventory.

06:29.650 --> 06:34.570
Whenever we do an e-commerce site, you know, inventory is the major thing that will be managed by

06:34.600 --> 06:36.520
the entire company itself, right?

06:37.000 --> 06:43.480
So here you can see, let's say in my inventory I have apples, bananas, oranges, grapes.

06:43.510 --> 06:44.020
Okay.

06:44.020 --> 06:46.900
So these are all the items that is present in my inventory.

06:46.900 --> 06:50.740
And then I'm adding a new item which is called as append strawberries.

06:50.770 --> 06:51.400
Okay.

06:51.430 --> 06:53.500
Now with respect to this particular strawberries.

06:53.620 --> 06:59.230
This is the new item that has come, and I'm appending it whenever there is one item that has been ordered

06:59.230 --> 06:59.740
by someone.

06:59.740 --> 07:03.160
So once we deliver it, we have to remove that particular item.

07:03.160 --> 07:05.560
So we have removed that particular item called as bananas.

07:05.590 --> 07:07.690
Let's say bananas was ordered by someone.

07:07.690 --> 07:09.610
So I have just removed this.

07:09.610 --> 07:10.060
Okay.

07:10.090 --> 07:14.110
After the, you know, delivery is done checking if an item is in stock.

07:14.110 --> 07:19.300
So if I'll say item is equal to oranges, if this item is present in inventory, I'll go ahead and say

07:19.300 --> 07:20.530
hey, they are in stock.

07:20.560 --> 07:22.000
Otherwise they are out of stock.

07:22.030 --> 07:24.880
You know, then we can go ahead and print the inventory.

07:24.880 --> 07:28.000
So here you are able to see that we are able to manage everything in the form of list.

07:28.030 --> 07:30.520
Yes, the scale of data will be quite huge.

07:30.520 --> 07:34.120
But internally this is all data structures will be specifically used.

07:34.120 --> 07:35.800
So this is another one amazing example.

07:35.800 --> 07:39.370
So if I go ahead and execute it here you can see oranges are in stocks.

07:39.670 --> 07:41.980
Since oranges are already present over here.

07:41.980 --> 07:46.600
And then inventory list you can actually find apple oranges grapes and strawberries.

07:46.630 --> 07:50.560
Okay now this was one more example, a good one.

07:50.560 --> 07:56.360
Now I hope you are able to understand what are beautiful, use cases are definitely there.

07:56.390 --> 08:00.560
Now this one, I'll just give you the task.

08:00.590 --> 08:02.060
Please go ahead and explore it.

08:02.090 --> 08:02.690
Okay.

08:02.720 --> 08:07.490
And, uh, just try to see whether you are able to understand it or not.

08:07.520 --> 08:07.940
Okay.

08:07.940 --> 08:10.640
So this is the code collecting user feedbacks.

08:10.640 --> 08:13.040
Use a list to collect and analyze user feedback.

08:13.070 --> 08:15.380
So here is my user feedback.

08:15.380 --> 08:16.130
Great service.

08:16.160 --> 08:16.880
Very satisfied.

08:16.880 --> 08:17.450
Could be better.

08:17.450 --> 08:18.170
Excellent service.

08:18.170 --> 08:24.830
Let's say another feedback is had added not happy with the service okay so we are just counting the

08:24.830 --> 08:25.730
specific feedback.

08:25.730 --> 08:27.920
So I'll say one for comment in feedback.

08:27.920 --> 08:30.200
If great in comment dot lower.

08:30.230 --> 08:31.160
Okay now see here.

08:31.160 --> 08:33.530
We have also used something amazing right?

08:33.560 --> 08:37.040
So I'm saying for comment in feedbacks we are exploring it.

08:37.070 --> 08:37.580
Okay.

08:37.640 --> 08:40.940
If a great word is present in that comment okay.

08:41.060 --> 08:43.850
If in all these comments great is present.

08:43.850 --> 08:47.270
So we are just going to do the summation with respect to one.

08:47.300 --> 08:51.350
Like if any time a great is present, I'm going to take one.

08:51.380 --> 08:52.190
Right.

08:52.460 --> 08:54.200
Or excellent in comment.

08:54.230 --> 08:55.340
All right.

08:55.340 --> 08:58.580
So we are just going to do how many number of time great or excellent is present.

08:58.580 --> 09:00.710
We're just going to keep on adding it up okay.

09:00.710 --> 09:02.750
So here you can see positive feedback count.

09:02.780 --> 09:03.470
We are able to get.

09:03.470 --> 09:04.490
So this is the variable.

09:04.490 --> 09:08.180
And then finally you can see print user in feedback comments and feedback.

09:08.180 --> 09:09.020
And we are printing it.

09:09.020 --> 09:10.580
I hope you are able to understand.

09:10.580 --> 09:14.600
So over here with respect to the output positive feedback count is two.

09:14.630 --> 09:18.890
That basically means if great and excellent is present over here, we are just going to count it down.

09:18.920 --> 09:19.520
Okay.

09:19.550 --> 09:21.530
So two times we have actually found out.

09:21.530 --> 09:23.270
So user feedback are like great service.

09:23.300 --> 09:23.930
Very satisfied.

09:23.930 --> 09:24.530
Could be better.

09:24.530 --> 09:25.940
Excellent experience.

09:25.940 --> 09:28.310
And the last feedback was not happy with the service.

09:28.310 --> 09:29.900
So that is also appended over here.

09:29.990 --> 09:32.870
So these are some of the beautiful examples.

09:32.870 --> 09:39.080
And again list is something I think the most common data structures that may be used everywhere.

09:39.110 --> 09:42.650
You know probably whenever we are working with larger applications.

09:42.650 --> 09:44.900
So I hope you understood this video.

09:44.900 --> 09:49.070
I hope you got an idea with respect to the real world example, and this was it for my side.

09:49.070 --> 09:50.300
I will see you in the next video.

09:50.300 --> 09:50.720
Thank you.
