Hello guys.
So we are going to continue a discussion with respect to Python.
And in this video we are going to see some amazing real world examples using list in Python.
Now guys you may be using a lot of applications.
You may be using lot of apps, you know some or the other way.
They are many, many smaller modules where specifically list can be used.
So over here I'll be showing you some of the examples.
Yes.
We are not going to develop a complete end to end project like kind of thing, but it's more about understanding
what applications specifically this kind of data structures list is used.
Okay, so the first example that I'm actually going to do is something called as manager to do list.
Right.
So we will try to create a list which will keep the task track of all the tasks that you are planning
to do.
Okay.
So let's say uh, I will just go ahead and create a variable to do list okay.
And inside this let's say today my task is I have opened my app and I have probably selected okay,
today I need to buy groceries.
Let's say I need to buy groceries.
The second task that I really want to do is that clean the house.
Okay.
Which is necessary.
Clean the house.
And let's say the third task that I have is something called as pay bills right now.
Uh, let's say after some time, uh, I had to get some kind of task.
I had to I got some more task, and now I want to add that particular task to my to do list.
So right now in the to do list is already a list.
So we know some of the inbuilt methods that we have already discussed, like how we can make sure that
how how we can add more tasks in our plate.
Right.
So what I will do, I will just go ahead and use this to do list dot append.
Right.
And inside this append I can probably go ahead and say okay, schedule meeting is one of my tasks.
I need to schedule a specific meeting with someone.
Okay, so this can be one of our task.
And after finishing my work, let's say I want to go to a run, you know, so I will go ahead and append
another task over here.
Something like go for a run, okay.
Go for a run.
Okay.
So this is my another task that I really want to do.
Let's say that I have done out of all these tasks, I have started my day, and the first task that
I have actually done is cleaned my house.
Okay, so what I will do is that after I probably in my app, you know, after I complete this particular
task, I will make sure to remove that particular task.
And once I removed write a completed task in the back end, what kind of what kind of code will be written?
You know, so from my to do list right, which will be in the session, we'll talk more about session
and all.
I will just go ahead and remove, uh, clean the house task over here.
So I will just go ahead and copy this entire thing, and I will just go ahead and say, hey, this is
completed.
So please remove this particular task from my list, you know, and then, um, let's go ahead and check,
okay.
Whether this particular task after removing it is present or not.
So here I will say checking if a task is in the list.
Okay.
And uh, here I'll say, hey, if let's say pay bills is there okay.
Pay bills.
Is there in the task okay.
In two underscore do list.
Then I will say print.
I'll send a reminder for me.
Hey don't forget forget to pay the utility bills.
Let's say this is my utility bill okay.
Utility bills okay.
So this is just like a reminder that I am actually getting.
And let's say after finishing all the work, how many tasks I really want to probably, uh, how many
tasks are remaining if I want to print it.
Right.
So I'll just go ahead and write, print.
This is my to do list that are remaining to do list remaining.
And I will just go ahead and print for task in my to do list print.
Let's go ahead and print with the help of F string F is basically a formatting string.
And this will just go ahead and display my task right now.
Obviously here I'll be able to see that from my task.
This clean.
The house should not be there.
And I should have this both the tasks that should be appended in my to do list.
So let me just go ahead and execute it.
So here you can see, hey, don't forget to pay the utility bills because I got a reminder, a reminder
saying that over there because pay bills is still there in my to do list, then the remaining to do
list that are remaining that are like buy groceries, pay bills, schedule meeting, go for a run.
Right?
So all this specific things are there and I will be able to keep a track of it so extensively.
I know in a bigger application you'll be seeing that a to do list specifically uses list, because with
the help of list you can actually remove it.
You can add it, you can append a new task over there and everything can be created through it.
Right?
So whichever programming languages you specifically go ahead with, list will be a common data structure
that will be used extensively.
Okay.
Now let's go ahead and see another example.
So here you have something called as organizing student grades okay.
And now I will just go ahead and copy and paste it over here code for you.
So here you can see organizing student grades.
So I have some grades over here 8592 7890, 88.
So I am adding a new grade.
Let's say new grade has actually come.
So I'll go ahead and append a grade inside this.
Then we'll go ahead and calculate the average grade.
So this is my average grade.
Find the highest and the lowest grade let's say by using inbuilt function like max or grades I'll be
able to get the highest grade and another inbuilt function by min.
I'll be able to get the lowest grade.
So this is how I will be able to see my highest and lowest grade, right?
So such a simple example.
But here you can also see that extensively list is basically used.
And just by using this inbuilt function like sum right which will get basically get applied in a collection,
specifically in a list right over here, you'll be able to see that I'm able to calculate sum of grades,
length of grades, and then I'm able to calculate the average one.
Right.
So this is another one example with respect to organizing student grades.
And here you can see average grade is so much highest grade is so much lowest grade is so much.
So that is what I'm actually doing to calculate the average of the students.
Okay.
Now one more example that I've actually taken is managing an inventory okay.
So managing an inventory basically means I'm trying to just manage an inventory.
Whenever we do an e-commerce site, you know, inventory is the major thing that will be managed by
the entire company itself, right?
Uh, so here you can see, let's say in my inventory, I have apples, bananas, oranges, grapes.
Okay.
So these are all the items that is present in my inventory.
And then I'm adding a new item which is called as append strawberries.
Okay.
Now with respect to this particular strawberries, this is the new item that has come.
And I'm appending it whenever there is one item that has been ordered by someone.
So once we deliver it, we have to remove that particular item.
So we have removed that particular item called as bananas.
Let's say bananas was ordered by someone.
So I have just removed this.
Okay.
After the, you know, delivery is done checking if an item is in stock.
So if I'll say item is equal to oranges, if this item is present in inventory, I'll go ahead and say
hey, they are in stock.
Otherwise they are out of stock.
You know then we can go ahead and print the inventory.
So here you are able to see that we are able to manage everything in the form of list.
Yes.
The scale of data will be quite huge.
But internally this is all data structures will be specifically used.
So this is another one amazing example.
So if I go ahead and execute it here you can see oranges are in stocks.
Since orange was already present over here.
And then inventory list you can actually find apple oranges grapes and strawberries.
Okay now this was one more example, a good one.
Now I hope you are able to understand what are beautiful.
Use cases are definitely there.
Now this one, uh, I'll just give you the task.
Please go ahead and explore it.
Okay?
And, uh, just try to see whether you are able to understand it or not.
Okay.
So this is the code collecting user feedbacks.
Use a list to collect and analyze user feedback.
So here is my user feedback.
Great service.
Very satisfied.
Could be better.
Excellent service.
Let's say another feedback is had added not happy with the service okay so we are just counting the
specific feedback.
So I'll say one for comment in feedback.
If great in comment not lower.
Okay now see here.
We have also used something amazing right?
So I'm saying for comment in feedbacks we are exploring it.
Okay.
If a great word is present in that comment okay.
If in all these comments great is present.
So we are just going to do the summation with respect to one.
Like if any time great is present, I'm going to take one right or excellent in comment.
All right.
So we are just going to do how many number of time great or excellent is present.
We are just going to keep on adding it up okay.
Okay, so here you can see positive feedback count.
We are able to get.
So this is the variable.
And then finally you can see print user in feedback comments and feedback.
And we are printing it.
I hope you are able to understand.
So over here with respect to the output positive feedback count is two.
That basically means if great and excellent is present over here, we are just going to count it down.
Okay.
So two times we have actually found out.
So user feedback are like great service.
Very satisfied.
Could be better.
Excellent experience.
And the last feedback was not happy with the service.
So that is also appended over here.
So these are some of the beautiful examples.
And again list is something I think the most common data structures that may be used everywhere.
You know probably whenever we are working with larger applications.
So I hope, uh, you understood this video.
I hope you got an idea with respect to the real world example, and this was it for my side.
I will see you in the next video.
Thank you.