Lists are collections that allow storing multiple items in a single variable, essential when the number of possible values is unknown or when multiple items need to be tracked simultaneously. Unlike single variables, lists can hold multiple entries without a fixed upper limit, making them suitable for scenarios like tracking multiple students' scores across different competitions. Key operations include appending elements (using ++), iterating through lists (using for each), and performing calculations like finding minimum/maximum values. Lists can store elements of different data types and can be combined with other lists. The order of elements in a list may or may not be important depending on the problem requirements.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
CT Live
Added:Good evening everybody. Am I audible?
>> Okay, let's wait for a few more minutes for more students to join and then we can start session.
Is this a question solving session or summary?
Uh no, we'll discuss week five concepts.
>> Okay.
Ma'am.
>> Yes.
>> Ma'am, I have one question doubting qualify.
>> Sorry, >> I have one question doubting qualify exam.
uh we'll take up doubts at the end. I'll try to cover uh the concepts of week five first because that is what the session is scheduled for. If there are any doubts uh I'll take it up in maybe the last half an hour if time permits.
>> Okay.
I I'll just be starting in two to three minutes because I think only 20 22 students have joined. Let me wait for some more because usually around 50 students join such sessions. So >> some doubt >> uh sorry >> can you take some doubt?
>> Yeah that's what I said right? I'll take doubts uh at the end of the session after the agenda for the session is completed. take doubts in the last half an hour if time permits.
it can be solved in two to three minutes because not many people >> I agree maybe yeah I agree maybe your doubts will be solved in two to three minutes but if everybody starts asking doubts one by one it'll take around 15 to 20 minutes at least of the session so I can't pick who whose doubt to solve and whose doubt not to solve right so we we'll first start with the agenda for the session because uh in the schedule this is supposed to be a week five session so we'll cover those concepts first otherwise even week five will be left.
Uh and anyway for doubts, I think the TA sessions are also there. So uh maybe those can also be used for help. But either way, I'll try to take up some questions uh towards the end. Even if some week five concepts are left, I'll reserve the last half an hour for questions. Is that okay?
>> No ma'am, I doubt from quiz one.
>> Yeah. Yeah, that is what I'm saying. The quiz one doubts, I'll take it in the last half an hour.
Okay, I think I should start with the session. Let me share my screen.
Uh, is this screen visible to everybody?
No, I think this is the first lecture of week five.
>> Sorry, uh your voice is not audible.
>> I think this is a first lecture of week five.
>> No, no, I'm not able to hear you properly. Can you uh repeat yourself or write it in the chat box?
>> He's asking that is this the first session of week five?
>> Uh yeah, this is the first session of week five.
>> Okay, >> I'll be starting week five from scratch only. The only understanding required till now is week 1 to four.
So basically this was week 1 to four, right? I'll just reiterate very quickly here. In the week 1 to4 revision session also we discussed basically the table how uh a table format is created. What are rows? What are columns? Uh the records are in rows. The attributes are in columns. What is the difference between an attribute and a variable?
What is iteration? What is filtering and accumulation? What is a function or a procedure that we call it? How to pass parameters? How to call a function? What to do? How many parameters can we pass?
Does a function has to return something or is it not necessary? All these things were discussed. What a pseudo code is, how to write a pseudo code from the flowcharts that you have. So this is basically u a very quick topic summary of what we had learned in week 1 to four. Now the main agenda of week five uh will be that introduction of first of all what lists are. So till now we were handling something called a single variable. a variable which either took an int or a string or something like that. But what if we want to store multiple things in one particular variable itself? We don't want to create multiple variables to store uh some information that we want to hold. So a collection of uh multiple things when we want to store in one variable that is when the concept of list comes. So that is what we'll be discussing just a brief overview of what the agenda is for today. So why are lists needed instead of basic variables that we had? What notations do we use for lists in specific to our particular course that you can expect? Uh what is normal list notation? How to append in a list? What the plus+ sign does. If if you've already gone through week five, you'll be somewhat aware of these things. How to build lists from a table if you have been given a table. How to iterate over a list. Let's say a list is a basically a collection of different things, right?
So what if we need to access some particular thing from that list? How do we access that? Uh all the utility functions that are there for using functions of basically uh utility functions for lists. Then we have how to use multiple lists together, nested lists etc. So these are some topics which are there in week five. We'll see how much we can cover today. At least in the first one and a half hours, I'll try to cover as much as possible. And as discussed in the last half an hour, I'll take to I'll try to take up some questions related to uh the qualifier or week 1 to four.
So I'll be creating uh till now I think you might have noticed a pattern that I try to create some data set for the session uh something different from what you've been seeing in the sessions or uh no not the sessions basically the videos or the data sets that have already been provided to you. So I try to make up a dummy session to make it a little more interactive because I think the other data sets you've already seen a lot. So I'll be doing the same. I won't be working with the food data set that we had till now. I'll be creating some techfest data set for the purpose of week five at least and based on that we'll be continuing. So I'll create a table. You can visualize it to be a card data set also or uh I'll be basically considering the table. So my notations for the pseudo codes will be in the form of a table only. Okay.
So let me see if I can just try to copy paste this maybe though I don't think so that will be possible.
Uh okay if not I'll just write it itself.
Oh great I can I'll just need to space it a little bit.
So considering this data set, we have ID, we have name, we have branch for the students.
Uh also I would like the session to be somewhat interactive. This is something that I have said multiple times because since I am here typing on Excal, it becomes difficult for me to understand if you guys are [snorts] able to hear me properly or not or if you guys are even present or have I left the meet by mistake or some network issue has come up. So I'll just keep speaking here without uh you know any assurance from your side. So that does not make too much sense. So I would request all of you to please participate.
>> Okay.
>> Okay.
So change the color for this. Yeah. Is this visible to everybody?
>> Yes ma'am.
>> Yes ma'am. So I'll just go through this data set once just to show you what all is there. So these are the attributes that we have. ID, name, branch, year, city, coding, quiz, gaming.
What is expected of you guys till now is that you are able to tell the data data types of these things. You are able to uh differentiate what all operations can be done on which all things here. But we won't be going too much into that because that has already been discussed heavily in week 1 to 4. This time we will focus on how to create lists from this data set.
So as we can see here the data set has ID, it has name of the student, it has the branch uh which student is from. It has the year which the student belongs to the city and there are three different uh just like in your school's data set we had maths, physics, chemistry, right? Similarly here we have coding, quiz and gaming. So basically you can consider this to be uh a techfest setup that students had a techfest in their college. So uh an ID was assigned to them for that particular fest. You can consider it to be uh the unique primary key or something for this particular data set. Then we had the name of the students, the branch of the students, what year they belong to, what city they belong to and uh what their score was in the coding round, the quiz round and the gaming round. So assume that in the fest there are three types of competitions that were held. One was related to coding, one was a general quiz and one was a gaming session. So in all of them each student has a different score and based on that we'll try to create some problem statements which will help us to see why we need lists right so one of the top of my mind one thing could be we can try to uh group these students by either year branch or city right how let's say we want to compare how the CSC students the average of the CAC students uh is working as compared to the ECE or the triple E or ME or uh how are students from Delhi performing as compared to the ones from Chennai, Mumbai or Pune? How are the first years performing as compared to the last years? Something like that.
Okay. So these are the kind of problem statements that can be expected moving forward. Uh okay. So first of all is the table clear to you guys?
>> Yes ma'am.
>> So now a typical problem statement for variables.
Problem statement for variables. Now let's say we we try to hypothesize a problem statement for variables. What could it be? Somebody give me a problem statement in which a variable will be used in computation related to this table >> anybody >> maybe counting who has scored maximum marks in each of the coding person gaming conducted.
Yes, that is a good problem statement.
So, we will have how many variables in that?
>> For each of the subjects, we would maintain a max.
>> Yes. So, max marks in >> each of this will have three variables.
Yes.
Yes ma'am.
>> Anybody else?
We can also say that how many students are came from like which city or which branch has been scored well in the quiz.
Okay. When you say which branch has scored well in quiz, what is the parameter for scoring well?
Your first one was correct. You're saying that it >> should be like relative to the someone or it we can give also the categories between above the 90 or above 95.
>> Yeah, that is correct. So first thing you said was how many students were present in uh from each city. So here again we will have how many variables?
>> Four variables.
>> So for this case we will have four variables because we have Delhi, Chennai, Mumbai and Pune. Now this is a very small snapshot of the data set. You understand this right? No data set will have just five members. There'll be at least 100 200 of students in each data set. And uh we don't have a cap on the number of cities allowed. It's not like we are saying that okay only five are allowed. So if you try to look at it from a perspective of how this will pan out when the data increases. Do you think it will be feasible for this particular thing to be solved with variables? The first one I agree it can be solved with variables because we know coding quiz gaming these three categories are only there. That is what we have defined in the data set.
Why? Because those are the attributes.
We know there are three attributes. But when we talk about the possible values that any attribute can take, we are not sure whether how many are possible or not. Right? Especially in a in a in a example like city, this is not something categorical. This is not something uh you know like there are only three just like we saw in the previous examples, right? The spice level there were three possibilities. Categorical variable was there. But city there could be multiple cities. We don't know the the maximum cap on the number of cities possible in this data set. So in this case what you're defining is how many students were present for each city. We will have four variables for this snapshot of the data set. But if we talk about a bigger data set with let's say 100 values it could have at least 20 25 or 30 cities.
Do you think it will be feasible to have 30 variables set?
>> No.
>> Right. This is where this is where lists come in, right? So one particular list it will act as one variable and in that particular list we will we can have 30 entries. So there could be a list called cities or count cities where uh index of each particular uh list will denote okay which city that person is from or something like that based on our definition what we want to define it as and it can it can store the number of students.
Understood?
>> Uh to be honest this problem statement is more suited for dictionaries but we'll come to that later. Don't get confused with that. Uh we'll see suitable problem statements for list also. Not necessarily this one but more suitable problem statements. Okay.
>> Yes ma'am.
>> Okay. So this was one. Now we will come to Okay. So okay we discussed why this is not suitable.
Okay. So this much we've covered.
Next coming to uh yeah so somebody said okay we we need to find out the highest marks for for each of them. Uh now the thing is in highest we are only considering the marks right or at max the student with the marks. What if I want to consider all the marks somehow?
What if I want to remember all the students who are from Delhi in this case they are just two. Okay. So that's all right. Let's say we had a lot more here.
Uh I want to remember all the students from Delhi in the sense that I want to hold all of their marks in a list format that okay in coding itself I otherwise uh if you if I talk about students from Delhi you see I'll have to create at least six variables only if I consider coding quiz and gaming.
Right?
Are you able to understand this part?
Why? In coding I will have coding student one one variable for each student right. So coding 85 then coding 95 then quiz 70 quiz 91 then gaming 90 and gaming 72. So six variables will have to be made just to store each and every information about the competition for Delhi students only. You able to understand this?
>> Yes ma'am.
>> So how can we reduce this? By forming lists. For lists we can have that okay for coding all the students who are from Delhi we will keep appending that particular score to the list and then it will be one list with 85 95 and even if more are to come the list will remain one maybe one for quiz maybe one for gaming. So similarly it will uh decrease the complexity of what we are trying to do.
Okay.
So we could uh just to I'm not writing a pseudo code here for now. I will do that later. But let's say this is what I'm talking about.
Just a second or we can also think of this as sum of or average of marks for each. So let's say this is what we have here. Okay. So Delhi students we have we have defined a variable here itself but this variable is not a single value you can consider to it to be a list defined this list Delhi students here is a list which contains uh let's say these four values okay this is from a bigger data set so for this one I will consider it to be let's say I want to uh Delhi students and what I actually want to hear right here is The problem statement to be sum of all Delhi students across the competitions.
>> Can you please mute yourself if you're not speaking anything?
>> So Delhi students are there. Sum of Delhi students across all competitions.
So first one will be what? 85 + 95 is what?
>> I'll write it7 by yeah I'll write it one by one so you understand what exact values I'm referring to here. So first is Delhi 85. You're able to see my cursor right?
>> Yes ma'am.
>> So first we have 85.
>> Then we have Delhi 95. This is for coding. Okay.
Then we have or let's say we can even define it. Okay. The coding comma quiz comma gaming. So for the purpose of this one we have defined this as coding quiz gaming. So first one we had the sum for coding. Then for quiz we have the sum as 70 plus >> 91.
>> 91.
>> Yeah.
Then for the next one we have the sum as 90 + 72 >> 72.
>> So now we have some values here. Now we try to Okay.
Just give me a second. Is my voice clear to you all? I think I'm noticing some network issues.
>> Yes, ma'am.
>> Yes, ma'am.
Okay, >> it's clear >> now. Uh, so yeah, now what we want to do is we want to find the sum. So 85 + 95 will be 180 right?
>> Yeah.
>> Yes. Then we have 70 + 91. So that will be >> 161.
>> 161.
Next we have 90 + 72 which will be 162.
>> So again close call between quiz and gaming but coding uh is clearly Delhi students are scoring the maximum in what coding >> right. So among Delhi students also we want to find out that what did they perform best in. So sum of all Delhi students across competitions. So >> students are performing >> we have completed our activities challenge then what do you think what should we do now should we post like normal or uh we should post >> uh can you please mute yourself if you're not speaking in relation to the session yeah Okay.
So now we have got a list where we have the sum of uh marks for Delhi students across coding, quiz and gaming. And we have already tried to define that the order in which we are adding things are coding, quiz and gaming. Okay. So now I'll try to iterate through these things. Uh now again this order that I have defined in this case we are doing it manually but again like I said this can be done better using a dictionary also. uh but for the for the sake of an example because this is not what I'll be using necessarily in a pseudo code. For the sake of this example of how a list is, I'm trying to define.
>> Uh, sorry.
>> Please uh mute yourself if you're not.
>> Yeah, please mute yourself if you're not asking any doubts.
So now within this list also we can find out the maximum. We can uh try to go through each and every element of this list and we can find out uh that in what particular thing the Delhi students scored maximum in. Right now that is again another keyword that we'll be using for each or something for which we will uh find out the maximum. So basically it is possible for us given a list to find out which uh which particular element is maximum or minimum just like we do for variables right we we iterate through different cards of a of different cards of the particular pile we have and we try to find out the maximum and minimum right similarly a list can be thought of as a collection of some variables which we have and we can find out the maximum or minimum amongst that Okay.
>> Order is important for list.
>> Sorry.
>> Order important.
>> Uh can you please speak a little bit more clearly?
>> Is anybody else able to hear them clearly? Can you >> like they're saying that order is important or not?
uh so in this ideally it is not in the example that I have given order will seem important but then again this is just uh coding quiz gaming example that I have given so uh in in the future examples and based on the things that we uh we expect of you in this computational thinking course order will not necessarily be important in a list okay they will just be collection of elements order will not be important okay just ignore this one uh So let me just write it here only or rather what we can do for this particular example itself is rather than sum right student across let's say coding I'm talking about because ideally list should not be having any particular order at least in the in the scenario of things which we are discussing here right let me try to rephrase it to avoid any confusion so it'll be 85 and 95 right so even this is a list understood if there were more students here then this list would have continued so now in this we know clearly that order is not important right we don't want to know which student was which we just want to know the overall marks of the student so that we can do some computation with Let's say now using this particular list we can find out the sum of students what all we can find from here.
Uh okay. Yeah.
>> The performance of students from Delhi in coding.
>> Yes. This list can be used to find the sum of marks of sum and as well as maximum minimum average of marks of students from Delhi in >> coding and quiz >> only coding. Right now this is only for coding. Mhm. Yes.
>> So, so Delhi students and I will coding right.
>> Yeah.
>> Similarly, we can have one list for and another for gaming. So, initially what I had tried to do in one list itself, right? Ideally, in the case of a list, we we should do it using three different lists. That was just for the sake of an example. So, we will have Delhi students quiz. We will have Delhi students gaming and then each one will have let's say uh the quiz one will have 7091 value the gaming one will have 9072 value and then using that that list we can do a bunch of things which I have written here can be used to find out the sum maximum minimum average and other things also right and then we can compare those values so you understood this part one thing was that okay we try to do iteratively using uh So we go through the cards again and again and again. We try to find that value and then uh simultaneously we keep a sum, max, min or average variable. But let's say we don't know what we want to find right now. We don't know what we want to uh uh do with the data. But we want the data separately.
In that case we can have a list to keep the data where the order will not be important. Okay.
>> Okay. So everybody understood this right? So, just give me a second h okay now let's say one another good problem statement for this could be one more problem statement I want to do for this is uh that let's say there are multiple students with the same marks In that case, keeping a variable for each student becomes tedious. It's very impractical, right?
>> Yes.
>> Let's say in this particular data set itself, I try to modify this value to be 72.
>> To be 72. Now let's say I want to find out that in coding which all students have scored the minimum marks given in this particular data set. So uh ideally what we will be doing is we will if if we talk about just one variable scenario that we used to do before. Uh what we'll be doing is we'll go through the entire list of cards. We'll we'll find out x dot coding. We'll compare it with the next one and if it is less than the next one we'll keep storing it. The first iteration you will have 85. Then we will have 91. We will not do anything. Then we will have 72 and we will try to save let's say the ID of this particular student. So 103 we saved in our variable.
This is what we used to do. Everybody is following this particular thing that I'm trying to narrate >> compared to the same category or different category.
>> No, we are just talking about coding for now.
>> Coding only.
So we we I just want to find out the student who has scored the minimum marks in coding.
>> Same mark.
>> Can you please repeat? I think your voice is not properly either it's not audible to me.
Can you try writing in the chat box?
Can you please try writing in the chat box?
>> Okay, now we hearing.
>> Hello.
>> Yeah. Yeah. I'm I'm said I'm not able to properly hear you. Please try writing in the chat box.
>> Okay, I will try.
uh same variable compared to MS. So I'm not properly able to understand what you're trying to ask here.
So okay, I I'll just try to uh explain my problem statement once again. What I'm I was trying to say. uh the scenario is or rather the problem statement that I'm trying to share here is find the students or student or with minimum mark in coding.
Okay, across all cities, across all branches, across all years and find the student. So student basically means ID. I want to find out the name or the ID of the student with minimum marks in colon. Okay, this much is clear what the problem statement is.
>> Yeah.
>> So this what what do we do now? Now whenever we have such a problem statement what we do is we iterate we keep two variables one is minimum marks I mean coding let's say and the other is the student right who who scored it let's say minimum coding mark. This much is clear. We'll keep two variables. We'll iterate through the cards. We will keep updating variables by comparison. Now let's say while doing all this we uh if if you try to do this through for for this particular data set right you will notice that initially we will have 85 as coding marks and 101 as the minimum student ID then we'll compare it with 91 we will do nothing then we will compare it with 72 and update it the the marks will be updated to 72 and the student will be updated to 103 then again we will compare with 95 now in the end we are comparing it with 72 again but A variable can only store one value, right?
A variable >> Yes, ma'am.
>> can only store one value. So now >> which one do I store here? The the second one or the first one. Both of them have scored 72. I need the information of all the students with based on the ids who have scored minimum in coding. So here see the minimum is 72 but more than one students have scored 72. I want to store all of them right. So instead of having a minimum coding marks or minimum student ID here as uh a variable we have it as a list. So minimum student ID will become a list.
So solution for this is right.
>> ID.
>> Sorry.
Uh can you brief about minimum student ID? I do not understand.
>> So minimum student ID is the ID of the student who has scored minimum. So minimum coding marks is there right?
Usually in this problem statement.
>> Yeah. So it's the student referencing the students. So ideally this will then be uh 102 oh sorry 103 and 105.
>> Right. So this is what we want to store.
Similarly, it could be the same for maximum also. Let's say in quiz we want to find out whose score maximum is 92 which we have. Let's say this one instead of 88, this one was 92. The same problem will come up here also. So you guys understood right? Why we need lists? First of all, this was the why lists This part was answered but we need lists.
>> Yeah. Why?
>> Can you please repeat?
>> No. Why did everybody understand this?
My voice is not clear. Is it better now?
>> Yes, now it's clear. Your voice is clear.
>> Yeah.
So, uh all of you are able to understand why we need list. This is very important for for the basis of week five is the need for list first of all. All the other things are what we do with lists, what all possibilities are there, [snorts] uh what kind of uh utility functions which we have, the kind of notations we have with lists. But what is important first of all is to understand why we need them. That much is clear to everybody.
>> Yes ma'am.
>> Yes ma'am.
>> Okay.
I am copying a pseudo code.
>> Here your is ma'am. Your voice is >> okay. Your voice is >> My voice is okay. Is it better now? Because I think my network is stable enough.
If if it breaks again, just please let me know. Okay. I'll try.
>> No, ma'am. Your voice is pretty clear.
>> Okay. Maybe it's a network issue with some of you guys. So, if you guys can try switching or reconnecting, that will be good.
>> Okay.
>> Okay. So let's continue. This much I hope is clear with you. I'll be copying one particular pseudo code for you guys and then based on that I will introduce the notations required for lists. I'm not keeping this particular session too much heavy on pseudo code because I feel uh all of that is very clearly defined in the slides. If you just go through the slides once right the need and everything is very clearly defined there. There are uh exceptional sudo codes already written there. So I won't be focusing too much on that because that will take up a lot of time. Maybe in the next session those can be discussed. Today I I want to cover the breadth of week five first giving giving giving the notations required the need required and maybe one or two examples.
Okay.
So uh a simplest uh we talked about why we need list. Sorry. Yeah somebody was speaking.
>> Why we need this?
uh that is what I explained for the last half an hour right uh so given I'll just try to briefly uh summarize this once again sometimes what happens is whenever we are trying to keep some variables keeping one particular variable is not enough let's for example this problem statement that we discussed it says that we want to find out the minimum uh marks as well as the students who scored the minimum marks in let's say coding in in uh the coding parameter of the competition and while we were iterating through this particular list we saw that two students have scored the same marks which are minimum. So now in if if I talk about the conventional variable which we had been talking about for the first four weeks, it would be difficult for us to understand which of them to u variable but let's say we want to store both of them in that case we will use a list. Basically a list is an example of a collection. Okay. So we I'm talking about a list here but what I'm a broader sense is a collection. So in the f will see multiple other collections also. There'll be dictionaries, there'll be lists, there'll be other collections.
Uh but the need for a collection or a a list being a a simp simplest form of a collection which we we are seeing right now as an example is that we want to store multiple things in one variable itself or assigning one particular variable in this case minimum student ID to a set of uh or or you know a collection of items but earlier we were storing it as one particular variable each. So uh for this example we would have had to store two variables just to figure out who the minimum student is.
We we would have student one or student two minimum student ID 1 minimum student ID 2. But that is not a feasible approach. So we try to create a list in which we don't have a cap on the number of >> uh items which we can store in this clear.
>> Yeah. Yes. Yes.
So it has a sequence of values and uh a single variable name is used to refer to the entire sequence. So we don't have to get confused between student one and student two, student three. It's students and then there is a students.
So we will go through the notation and pseudo code a little bit and some operations that can can be used to manipulate lists. So, okay.
So, I was going to attach a pseudo code here or rather let me Okay, I have some pseudo code with me, but I'll have to modify it a little bit.
Let's see. I'll try to put it here.
>> Hello, ma'am.
>> Yes.
Can we store more than one type of variables in this list like name, marks?
>> Uh so ideally yes it totally depends on the definition. So in collections yes definitely you can store multiple types of things in one particular collection but uh for uh ideally if you talk about lists in other languages then yes uh but it totally depends on the statement that you have defined. If in your problem statement you need multiple types uh then yes go for it.
Okay.
Okay, just give me a minute.
Okay. So for this itself, right, let me have a student ids. This is the list that initialized Yeah. Then my pseudo code says while.
I want you guys to fill this out. This is very basic. Now while we're talking about tables, what do we say? While >> table has more rows.
>> Table has more rows.
While table has more rows, what are we doing?
Read row. Let's say X, right?
>> Yes.
>> Read the first row.
>> Also had one more variable minimum coding marks. Let's say 100 I'm assigning everybody assigns why everybody's understanding why I'm assigning this as 100 right?
Yes ma'am.
>> Maximum marks >> I think some of Yes. maximum possible marks.
>> Now uh what will be next? We read a row from X.
Now what are we comparing?
>> Come on guys, this is basic. You just yesterday gave an example this >> minimum supporting marks greater than student ID dot marks.
>> First of all, we'll be using if >> minimum coding marks >> less than you can. Shouldn't we check if it's >> Yeah, you depending on the uh depending on the problem statement, you can either negate that also. But yes, if coding marks is greater than >> coding, >> right? Then what do we do?
First of all, >> coding marks is equal to X doc. minimum coding mark x code is equal to x dot code but again here I want it to be greater than equal to because in that case where it will be equal right even in that I want to store this particular person the next thing I'll be doing here is minimum student ids is equal to minimum Student IO just give me a second X >> plus X dot id right so this is the notation if we want to append anything to a list right we use this plus+ and then we add this particular here we discussed this in detail this is just uh an introduction question.
>> So ma'am, here you make it greater or equal to.
>> Yeah, I made it greater than equal to here because I want to add students who are equal to, right? Uh for in this case, initially we would have had 72 in 103. So we would have add changed minimum coding marks to 73 in one in that example. Let me add it here with another color. We would have had 73 here. Right? And the other one would have been at some point it would have been 10.
>> So that means here the maximum mark might can be.
>> So here the maximum mark can >> not maximum >> above 100 marks can be obtained more than 100.
No, no, it can't be.
>> You mention 103 is the ID.
>> These are the ids of the students. If you notice here also 103 and 105. I'm look basically the purpose here to find out who has scored that right. We want to find out the student not just the marks. So who has scored that?
73 statement conditional statement the minimum coding marks the minimum coding marks is 100 you make it greater or equal to then if it is more than 100 then only in the condition of the body of the statement the code will go otherwise it will skip It can be less or equal to. But if we make it greater or equal to no why will it skip? See uh try to run it once. Minimum coding marks is 100. We read a row x.
>> If minimum coding marks is greater than equal to whatever coding marks we have here.
>> Currently 100 is greater than 85.
>> So it will enter. No suppose minim here the x coding marks might be 85. Suppose x dot coding mark is 85 then what will happen here?
>> Uh x dot coding is 85 that is what we see the first one to be right. So what will they compare here? So it will compare 100 greater than equal to 85 which is true.
Since it is true, it will enter.
>> Okay. Okay. Okay. Okay. There are some confusion. Okay.
>> Right.
It Yeah. So since it will true since it and then after it updates it to be 85, it will update the student to be one. But then this will keep on happening and at one point we will reach 73 10 to be the minimum. Now next what will happen? Sorry 72 72103. Now what will happen is when we reach the last line at that time we want to add that person to the minimum student ids list which is there right we want to add that person this much is clear with everybody that was the whole purpose of the exercise right that we want to add that particular person but if we have only greater than here we will not be adding that right only when we have 72 greater than equal to 72 true only then we will enter this We will again minimum coding marks is equal to x.coding will remain the same only. It will be 72. But in minimum student ids I will this time append this particular student. If I would have just put greater than then we would have not entered in that case and 105 would not have been added.
You understand this right?
>> Excuse me ma'am.
>> Hello. Excuse me ma'am >> ma'am like I have a doubt here >> uh like suppose the first marks is 85.
>> Mhm.
>> Uh uh like first x doc coding is 85.
>> So the minimum ID will be 101.
>> Yes.
>> Then uh then the minimum student ID uh then uh that will store 101.
>> Yeah. No no no. Yeah. at that time uh >> uh 101 and then next again it will be executed so it is keep on adding that part now because every time it will be less than 100 what I'm understanding here >> yes correct >> exactly nice nice catch here >> uh correct that's what I also my I am sorry because each each time it will enter the every number there >> yeah okay so we will have to fix that here yeah I missed that my bad thank you for pointing it out so every time This gets updated right?
Every time min coding.x.coding gets updated. What we have to do here is we can have a we can have a Can you please mute yourself?
We can have one here.
Can you can you please mute yourself? Uh there there is a lot of noise from somebody's end.
>> Yeah.
Uh Kushell, can you please mute yourself?
able to find that meaning the student also and the participants.
Yeah. Kushell, can you please mute yourself?
>> Can you please mute yourself? There is a lot of noise from your end.
>> Yes ma'am.
>> Yeah. So here uh in this case maybe we can have some small condition here which says that uh rather than doing it here right one more thing which we can do it it it'll be a little more this is this is this is not the most optimal way that we can do this but just for the sake of clear understanding I'm trying to throw this here. So first what we'll do is we will find out the minimum coding marks.
Okay, this much is clear. First the first uh point of action here is to find out the minimum coding marks for for for this particular table. After that now this will introduce one more keyword for you.
After this, what I want to do is uh okay >> uh uh excuse me ma'am like uh uh uh that process uh we can't do like we can move one uh in the table two and then we can compare and which one is the minimum then we'll take that by comparing something like that what we are doing earlier here >> earlier. So basically what we want to do here is that whenever we have minimum coding marks we first want to find out what is the minimum coding marks and then based on that we will add minimum student ids.
>> H first execute this if loop.
>> After executing this if loop we get the minimum coding marks.
>> Yeah. So no not just if loop we have to execute the whole whileing loop because I want to first go through the entire data set once find out what whatever minimum is there then again we will have this loop let me just copy paste it here >> again not the most there might be more optimal ways here while table has more rows we will and if in this case the marks are equal to because we've already found out the minimum coding marks right so in In this case, whatever min code marks has, it is already 72.
The value is already 72. We check if they are equal. In that case, minimum student ids ++ is equal to minimum student ids ++ x dot.
This is clear now.
So in this first what we are doing is this whole section uh find the minimum marks.
So this is finding the minimum marks and then here what we are doing is update the list.
Okay. So in two sections we could have done this in one also uh in one by loop also this was possible but again it would have been a little more complicated. So let's go with the basic right now. Now let's say >> hello man.
>> Yeah you're audible >> but the vil will be continuously going on. They're not changing table.
>> Again your voice is not uh properly audible. Can you please repeat please?
>> The while loop is continuously going on.
We are not changing a table from one table to another table.
>> No it has while table has more rows right.
Yes, we are not moving to anywhere. Uh, >> okay. So, you're saying that like like we say that okay in the end we say right put pile put this into pile two or something. But again when we are talking about a table we just talk that okay it has more rows. So when I'm assuming in this that okay when we are reading row X and then we are moving to the other one we are already uh basically here this is an assumption only from my end that read row X then update to next update X to next row or something.
Okay.
But again I think when when it comes to tables this is sort of taken for grant when we're talking about piles uh it is one particular step that we are keeping it in the other pile. But when we're talking about tables once that particular row is gone the second while loop uh it is automatically the next row but we can write it if you want. Okay.
I'm just one thing from an understanding perspective the first block which you have written of if minimum coding finding the minimum work marks right so that creates one table no it is not creating any table is already there we are going through the table and we are updating the variable called minimum coding marks and then we when when we find out the minimum coding marks then in the second while loop again We are not creating any table. We are updating the min coding marks uh min student ids. We are updating the min student ids based on some condition of min coding marks. We are not >> is it updating in the same table or same >> there the table is the same only right?
There is only one table which we are referencing to here.
>> Uh uh excuse >> what we updating is student ids.
>> Correct. But where it is getting updated?
>> Main student id is a is the name that we assigned to this collection right is name which we have assigned to this collection here the first line. So this is getting updated this empty list which we had earlier. It is getting updated and at the end it will 105 as the answer.
>> Okay. And it doesn't need that return thing right which we had seen it in.
>> So this is not a function not a function right now. This is just a pseudo code.
>> Okay. Excuse me ma'am. Excuse me.
>> Yes, >> ma'am. Ma'am, excuse me. Uh hello.
>> Yeah. Yeah, he's gone.
>> Uh ma'am, like uh the first if loop like while then if condition is there, >> then uh uh we are ending that if condition.
>> Uh so where you have written update no update x. So there if we write like uh uh minimum uh uh student ID is equal to minimum student ID plus we'll mean append that one list. So I think we'll get the result there only because >> this is exactly what this is exactly what we were doing and initially I had missed that point. We had done that and then somebody pointed out correctly that when we are doing that when we append a list right even if so list is not getting initialized every I was only there uh because before this append was inside the loop if we uh if we'll keep the append outside of the if loop I think it will be it will store the minimum marks so no need to write the second while loop I think so >> why will it store uh so we will have to somehow inside the loop Uh one thing can you do this one appending one can you copy and paste it over uh that part update one over there can you paste and then you can see that how it will be executed >> I don't download >> if you have yeah if you have >> not if condition not if condition just minimum student one yeah this one like >> yeah even if you have this there right ma'am >> assuming that this is here next to update just copy And uh >> what will happen is try to visualize what will happen.
>> Yeah.
>> Even if we are updating main coding marks that is okay.
>> So we updated main coding marks. Let's say we had 72.
>> Yeah.
>> Okay. Let's start with the beginning.
Let's say we had >> we updated updated main coding marks to 85. Then we coming out of that if loop anyway, right? We are coming out of that if loop >> and after coming out of that if loop 85 will at least be appended.
Means student ids will have 101 no matter what.
Then after that it will check with 91.
Okay, it will not get updated. But again 72 will get updated. Then again 72 again will get updated. For this particular data set that you are saying the answer will be 101, 103 and 105.
>> But for some other data set in which let's marks are already in descending order in that all of them will be added.
>> Yeah, got it. Again it will be mean uh keep on it will be added down if you'll keep outside the if loop then also more effective. That is why >> in this case the best option is to have different while loop for understanding purpose because my purpose here is not to understand the logic but rather show the purpose of lists right otherwise if you talk about it in one while loop it is possible have to keep this inside somewhere. Every time we are updating this right we have to we will try to maybe keep a flag or something and we will check that if we are entering this list and this is getting updated somehow.
If we are entering this then inside this if itself we will try to we have to first check that the minimum coding marks and the ex coding marks should not be equal then they should be separate and in in that case we will have to initialize this min student ids again whatever is there in that let's say 101 was already there we will first have to remove that 101 the list and then again start appending to it from scratch it can be done with one also but again that will complicate the logic And my purpose here is not to complicate the logic of the pseudo code but rather to explain why to use a collection right or how to use a collection.
>> Madam uh suppose here the as the example says that 72 is the minimum marks but 72 has two candidate 72 is obtained by two candidate.
So if we execute this uh this loop uh it looks like this minimum coding marks after executing this loop minimum coding marks is the 72 it assigned.
>> Yes.
>> But this how this minimum coding marks to assign to the two students two students ID.
What we are doing in the second check whether the minimum coding marks is equal to the row that we are reading right now. If it is equal then we know that that particular student has that minimum marks and then we are appending that student to the list.
Uh that is okay. But you you execute this upper while loop and after executing the whole while loop what it does the uh student ID 105 this will be updated.
This is 7 >> will not be updated.
>> Why will they be up? So the table is as it is. We are not updating anything in the table. We are only updating the minimum coding marks variable which we have and that will get updated to 72.
Right?
>> Means this X that that is the last row >> uh this 105 is the last row. No.
>> So this X will represent this 105 >> and when you mention this X dot student ID or such kind of thing. So it will pick the 105 that's what I mean I it seems like this.
Yeah.
>> Then how we get this 100?
>> These are two different Y loops. And when we start a different Y loop, yeah, when we start a different while loop, it will have a different X, right? So X will change. X will keep changing from 101 102. Whenever I'm doing update X to next row, X will keep on changing from first it will be 101 in the first iteration of the loop. Then it will become 102. Then it will become 103.
That is how it is changing again and again, right?
>> No, no. Till the all the rows will be completed >> static in all the iterations.
>> Huh? Means while we mention that table one has more rows that means until and unless the all the rows are executed the while loop the code will not exit from the while loop.
>> Yes.
>> So first we go through all the five rows in the first while loop. So this particular while loop goes through all the five of them >> and we find out one particular thing from that. Then the second while loop begins and we start from the beginning.
Now table has more rows. Table is as it is.
>> Table has more rows. This is a new row x here. So this this y loop and this y loop are not executing together. They are executing one after the other. So this x here is different. You can just to avoid confusion. Right. We can have >> ah that is okay. That that means in the first executing the first while loop it it assign this X will assign to the 105 this is the last row and it will just check this minimum coding mouse is equal to Y Y dot coding >> H >> then what will happen what is >> and after that no what is Y now as in we are reading row again right table has more rows table is as it is right we are not uh removing any rows from the table we are just Okay. Okay.
Is there as it is?
>> Uhhuh. It will compare the minimum coding mark that is it will compare the 72 with the all the all the all the rows again.
>> Yes. Yes.
Okay.
Uh so this much is clear to everybody.
Now uh in this you might have noticed we did something called this particular line plus y do id. So this uh brings up the question what all other such things are there. So this you understood we are appending this particular element to the list which is already there. So now coming to what all other possibilities are there.
Madam what does it mean this before plus+ and anything any syntax is there after after the after++ also means >> yeah we'll come to that okay so uh some simple things I'll be writing here just give me one Now this this we know is an empty list right now. No element is there. Some other example of list which we saw is 101 103. This was again uh an example of a list another list could be some characters also let's say we had I wanted to save the names so in that case Kabir and this is also a list right these are some examples of list if if I talk about how to initialize an empty list what is a fill list and everything. Now let's say I already had an example of a list. If I talk about here rather let's say I have something called a dummy list and right now the values I have assigned are 2 6 9 1 2 6 1 2 6 1 9 0. Okay, this is currently a random list I have. What if I do dummy list equal to dummy list ++ 3? What do you think dummy list will be now?
>> Uh three will be added in the last.
So the new list will be 2 6 1 9 0 3. This much is clear to everybody. This is what we were doing initially also.
>> And what if we use only single class instead?
>> Sorry.
>> What if what if we use only one plus?
>> That is not the syntax, right? The syntax itself is two plus.
One plus is for addition. When we talk about appending at the end, okay, this is so when we try something at the end, this is the syntax which we are using. If we want to append something in the beginning, then a separate order will be used here. So let's say I have list is equal to or plus dummy list. In this case, what will be the response for the dummy list will be 4 2 6 >> 6 1 9 03 >> 2 3. So this much is clear. What? Plus plus >> this is what if I talk about this >> what >> this is appending in the append clear. Uh yeah you're audible but in list it is irrespective of order right? Sorry, >> list is irrespective of order. We can add anywhere now.
>> No, no. So ideally what we're trying to do in a list can be irrespective of order. So when I say right, so what I meant when I said that order is not important here is when I was talking about physics, chemistry and m uh sorry not physics, chemistry, coding, uh quiz and gaming. Right? So in that case if I want to have that particular order in terms of what we are doing in a list that is not the kind of order which we are trying to preserve but let's say I want to add something in the beginning in the end in that case that particular order uh whether we want to add it to the start or the beginning that can be preserved that is in our hands but let's say we when I talk about a card uh thing right so we going through that particular pile and adding something in a particular order that order may or may not need to be preserved because again that in that we are following maybe the uh whatever the order of piles is there.
Are you understanding the point that pile itself might be shuffled in that case we can have a list but it will not be in some particular order.
Is that clear? Maybe we maybe you'll understand it a little better when uh you see some more examples in the end.
>> Okay.
>> So there are two types of orders, right?
One is uh we we may be talking about uh order itself in that particular list.
A list has five numbers. Five are they in order or not? The other is that we are trying to say we have three categories and we are trying to preserve the order of those categories. So those are two different things right we can do the second one also but we can't ensure that throughout or maybe in that particular problem statement that was not the most optimal way to go about it for those kind of uh data we have a separate collection called a dictionary we don't use a list you'll see dictionary in the upcoming weeks >> okay ma'am thank you >> okay so uh now this is what we did when we when we were trying to add one particular list to another list using the second list we were making it on the spot so this is a list only right so this is how we are appending an element by making a first by by first making a list itself let's say I have another list dummy list two and this has values 6 2 0 one. That's it.
Now, if I do dummy list P is equal to dummy list or dummy list plus dummy list two plus plus we won't do here. Why? Because this is a collection not a normal which we can do plus with. So plus+ is very important.
This case dummy list three will be what?
Who will tell me this?
>> Both will be combined. Yeah, both will be >> 62 61 9 03 6 >> 0 right this much is clear.
>> Now we have uh first we were extending L whatever list we had with some item appending at the end. Now >> can you explain again ma'am? I'm not getting >> okay just till what part was it clear?
>> So ma'am if we enter only plus then what will happen?
>> Plus basically means addition right?
Syntax itself will be wrong. For example, if you are adding two uh numbers A and B, A has 10, B has five, and you do A + B, then that doesn't make sense, right? Because 10 + 5 will not uh give you the correct answer, right?
So depending on what you are trying to work with what what variable or what correction you are trying to work with that is how you use these uh symbols which we have plus minus plus+ things like this right so when we're talking about lists or one list with extending an element to that particular list we use plus+ >> can we check two list that is are they are equal or Uh yeah, we can do that also. We'll come to that later.
>> Okay. So uh we talked about extending a particular list with an element. We talked about appending two lists together. Now coming to how to process a list. We got a list. We obtained a list.
Now this is our dummy list three which we have. Now I want to go through this list. Right? I haven't made this list just for the sake of being in a list. I want to go through this list. I want to do something with it.
So now in order to go through the list, what we can do is we can use a keyword called for each.
So what we do in for each is if I talk about one particular syntax of this for each x in the main list.
>> Ma'am please can you explain that part again?
>> Which part >> ma'am that you are writing in the green thing? Yeah, for uh let's say we have obtained a list already. So in this let's talk about the earlier dummy list which we had final 4261903.
We have a list but now we want to do something with that list. Right? The purpose of having a list is to process it, right? To maybe get something out of it. Correct?
That much part is clear, right? We have a list of certain things. Now how do we go through that list? Iterate through a list. When we had piles of cards, we used to iterate through it, right? We we used to have first one, we used to put it in the second pile, then second one.
So, similarly, here we have a collection of something. A list has different different different variables uh I mean values assigned to it. Now, we want to iterate through these items. How do we do that? So, we do that using the for each keyword. For each x in dummy list, sum operation.
care about what operation we are doing right now some operation we are doing for eject let's say we I want to find out the sum so sum would be let's say here itself right a very don't look for a particular logic in this that what this represents sum equal to sum + x let's say at the end sum will be the sum of all these Okay.
>> So this is something I got it.
>> Yeah. So this is something which we can do with lists. So here we are processing something. Now again this is for each.
You see how for each is very similar to uh the while we had while right. So we had also studied that for is also possibility similar to while. You see in while also we are iterating till a certain extent till table one has more rows we are iterating again and again and again we are going through that loop. Similarly for each also you see it's very similar to while for each x and dummy list. So first we go through four. We will do sum + 4.
Let's see what how sum is getting changed here. So sum was initially zero.
Then what do we what we did was sum is equal to 0 + 4. Then in the second iteration it became 4 + >> 2. So similarly then it became + 6 then + 1 then + 9 then 0 then 3. So this is how it is changing right? This is how sum is changing.
That much is clear right?
Any doubt at this point? Do you guys have any doubt at this point?
>> No ma'am.
>> Okay.
>> No ma'am.
>> Okay. Okay. So this much is clear. Now coming to now one thing is that uh inside while also we saw that we can have multiple while statements. Maybe in week four you might have seen a little complicated structures. Similarly for each also we can have nested things for each X and dummy list we could have again for each X and dummy list and then we could have checked it.
So if you if you have already gone through the contents of week five this will be very intuitive and clear to you but if not I would suggest go through the videos once because this it will help you understand this much better.
But uh essentially what we are trying to do here is that uh we have one particular for nested for each right for each inside another for each. So okay so how many of you remember or are already aware of the concept of for of nested nested lists?
You >> use it for comparison.
Sorry.
Yeah, we can use that for comparison. So the purpose that we'll be using it for will be comparison only. So coming to an example, right? If we have to uh compare various marks. Uh so again I I won't go too much in depth because because last half an hour we want to discuss some questions also. So for the next 10 minutes I will try to teach you some syntaxes related to this. We won't go too much into a pseudo code. We can do that in the next session maybe. But uh if you go through the videos you know that we were talking about top three marks right in subjects. Similarly in the example we saw we can also have top three marks in coding quiz and gaming right?
>> Yes ma'am.
>> So for that we will have to keep three variables right. A maximum variable a second maximum variable and a third maximum variable. that to for each subject correct?
>> Yes, >> you remember procedures, right? For each subject, we are doing essentially the same thing. So, we will make a function or a procedure and then for that we will as a parameter we can pass coding quiz and gaming and in the pseudo code we will have maximum marks, second marks, second maximum marks and third maximum marks. Right? So in order to do this let's say we have created a list. So initially we were just talking about the marks. Let's say we want to find out the students for that particular marks. So we can initialize lists for each subject that a coding list we have a quiz list and we have a gaming list. Three separate lists which we can have and then for each row we can find out similar thing we did. I'm not talking about something too complicated here.
whatever we did here itself right I'm doing this for all three of them this one was for coding right I'm trying to do this for quiz also and gaming also so we will have three separate lists now are you able to follow this guys some participation hello am I audible >> yes ma'am >> so this part we did for coding Right now let's say I do this for both quiz and gaming also. We will have three lists.
One one was 103 105. In the second one let's say it will be 101. And in gaming it will be 104 or yeah 104.
Three lists we will have.
>> Yes ma'am.
>> So now let's say we want to compare these three lists among themselves. We have already gotten all the students who scored the minimum in coding, quiz and gaming. Now let's say we want to find out students. We want to check whether two sim two one particular student was uh scoring least in all three or at least two of them. That did the student who scored minimum marks in coding also scored minimum marks in quiz or gaming or was there one particular student who scored the minimum marks in all three coding, quiz and gaming. This is how we can categorize students.
Correct?
This problem statement is very important. Is it clear to you guys? And this is not a new problem statement.
This is actually the three prize problem that I'm trying to discuss with s with a subtle variation. There we were talking about maximum marks. Here I'm talking about minimum marks. That is the only difference. Otherwise you have already seen the three prize problem. Right?
>> Yes sir.
>> So this is what I'm talking about.
Instead of prize you could consider it to be who needs extra classes more.
>> Okay.
So first I just want everybody to confirm whether this much is clear because this is the basis.
This is essentially week 1 to four. I have not introduced any week five concept in this at least the last five minutes that I spoke.
Okay. No response from you guys.
>> Okay. Okay, so we will be creating separate lists for each and then we can use those lists to compare with each other. Let's say I already have three lists of how I talk about and now I want to find out who scored the least. So in that case amongst those three lists we will compare these lists with each other and then form a new list to find out the common items.
Let's say here I have dummy list two and I have dummy list three. Now I know dummy list three and dummy okay rather than this example let me take a separate example itself.
So I'm uh applying this particular code for three students.
Okay, let's say we had coding min.
This was 103 105, right?
>> Yes sir.
>> Let's say we have quiz minimum. Quiz minimum is what? Who scored the minimum in quiz?
101.
>> Okay.
And then we have gaming minimum.
>> Gaming.
>> Let me change data set a little bit.
This is this is 104, right?
>> I I want to have 105 as common, let's say. So, let me change this to 70. Now, now it is 105.
Let's have one more 70 here. Instead of this 95 here, let's say I'm seeing 70.
So again 103 and 105.
Okay. Not this one. Okay, let's say 81. Instead of 81, I have 70 here. Now, this will be 102 105.
>> Right? This is what we have. I'm bringing this towards the end here so that I can work with it with a little bit more space.
Okay. So this is what I have now. three lists I have for each X in coding min right minimum marks in coding let's say first I'm comparing two things for each X in coding min again for each this is what we call nested for each for each let's say Y in quizman Okay.
If x equal to equal to y.
Then what do what do I do? What do I want to do? I add one more list, right?
Coding quiz mint. Somebody who has scored minimum in both coding and quiz.
This is what I want to find.
Then coding quiz plus plus x or y because x and y are same.
>> Yes sir. Right now for this particular example, we won't be finding anyone because there are no common. But let's say we was we were doing it for gaming coding and gaming.
Okay, for that uh I want to run it once.
Let's say I had this.
Let's say I have this particular thing here.
How will this go about?
Will this append a list of gaming?
>> Sorry.
>> Will this append the list of coding gaming?
>> Yeah. Yeah. This will append the list of coding gaming but with what >> it will minimum.
>> Yes. Let's try dry run this initially.
Okay, this was empty, right? I will try to keep updating it again and again as an okay so I'll be updating coding minimum as it updates here initially it is empty right >> yes >> yes ma'am >> so let's go about this one by one and see how this updates for each x in coding min so x is 103 so we enter this loop Now we go for each Y in gaming min. So right now X is 103 only. Let me also compare the value of X and Y here. So X is right now 103.
Y is what?
>> 102 >> 102.
>> We compare it is not the same. We again go to for each Y. So Y gets updated to 105.
Right?
So the inner loop will execute first here for each x encoding min for each y in gaming min. So x is fixed to 103. Uh I tried for 1 y is equal to 102. It was not the same. Then I will try with y is equal to 105. It is again not the same.
We will do nothing. We will go back to the second line which is for each x in coding.
Correct?
>> Yes. So now what is x updated to 105 >> 105. Now y is again 102 again not equal.
We will not do anything. Now again we will check this. It is equal. This particular thing will become 105.
Clear?
>> Yes ma'am. So when this becomes 105, we know that there is a student with the ID 105 who scored the minimum in both coding and gaming.
>> And gaming.
>> Yes. Now let's say we want to find out if there was one particular student who scored the minimum in all three. Let's say 105 scored the minimum in this also.
Uh again I'll have to change it. Assume that that is the case. And let's say in quizman also 105 was present. In that case, we will now compare this new list which is already the minimum of two with the quiz min list. You can understand why because if they have already scored minimum in two, they're in this list.
Right? Now I just need to compare this list with quizmin just like the three uh price problem.
Now we will >> uh ma'am we can only compare two list at a time right?
No, we can compare three also.
>> Means we can do >> it's just the amount of how many for each. Yeah, you can have and here also, right? Let's say I had one more for each here and then I would have done Y equal to equal to Z and then updated something. It will increase the complexity for sure but there is no limit to how many nested for each we can have. I'm I'm giving this example with a very basic uh scenario where we have two for each in nested but we can have multiple for each for each x and coding min for each y in coding min only right now I check with a different particular list we can have the same list also in multiple uh nested iterations again this is a very problem statement specific thing >> uh so ma'am we can't use like x= to equals to y and that equals to equals to z right >> we can do it like this x = y and or let's say uh this particular syntax whatever syntax which we are using let's say we using and right y equal to equal to z this is correct okay ma'am okay so this is about nested so okay nested is So you understood right uh how how we can compare everything. We we made one particular list here. Now we will compare this new list with quiz minimum to find out the overall minimum student.
Now coming to the functions which are possible on a list. I will try to uh imagine a list is there and then based on that what all functions we can perform on that list. Okay, this is the last part. I'll try to skim through this a little quickly and then maybe we will pick up the questions we had. Uh so I have length let me try if I can copy paste something here so that it easier.
Yeah.
Yeah. So these are some some things which we have. Let's say L is 37 9 0 1 5. Okay. Random.
What is length of L here?
>> Six.
>> Yeah. Length is the number of elements is equal to six. This is the number of elements in the list.
Got it.
Next we have first of L.
>> First of L is the >> three.
First of L is three which is the >> three element.
>> First element of the list. What is last of L?
>> Five.
>> Five which is the last element of the list.
Now what is rest of L?
>> 7 9 0 1.
>> So rest of L whatever we have uh given as the list right? Rest of L is always everything except for all of the other ones you see were elements right they were particular number 6 35 rest of L in itself is a list.
So we have 7 9 0 1 5 which is basically everything >> except the first. So from this we can say that first plus rest. So L is always equal to L is always equal to first of L as an First of L is always a number. So when we are appending we will have to put it in the as a list first and then rest of L is a list itself.
This one also will be this.
You got this part. This is very important.
What about last element?
>> L is first of L. First of L was an element, right? So we will put that into a list and we append that in the beginning to the rest of L. So this will give us the actual list.
Similarly, L is also equal to init of L + last another last of L.
Now how does this work? Now this init of L is what? Whenever we whenever we have something everything except the last. So here it will be 3 7 9 0 1.
And this is basically everything except the last. And this brings us to these two things which are there. How do we get the initial list back from this? Now let's say I say um again this is an exercise for you guys. Tell me what the answer for this would be.
first of init.
What is the answer for this?
>> Three.
>> Okay. What about last of init?
>> One.
So now you see last of init of L a combination of some init or last or basically anything of this has given us some element which in the overall list was neither first nor last. So if we want to find out let's say second last or something like that then we can try doing something like this. Now this is where somebody asked about the notion of order right? This is where the order comes into picture. Let's say the list we we have been given. Now this is very specific.
VB should have been given according to the pseudo code or explicitly that the list is ordered and in that case if it is ordered then this is the uh way which we can find out the second uh largest or second smallest element or something.
Okay.
>> Thank you.
>> So you you have to understand the question and the nuance to find out whether it is ordered or not. So read the question. If the notion of ordered is there then consider it to be ordered.
Otherwise if we just talking about random piles then uh it it can be some random order. It does not matter. Okay.
Now in order to see the examples of all these things in too much uh depth you can look at the slide of tutorial 5.1.
Okay.
Or you can just watch tutorial 5.1. All these examples have been discussed in great length here. Now member membership function member of member basically returns true or false member L of E right. So E here can be anything. So there are two possibilities here.
If E is in L then it will give true else false.
Okay. So let's say we have member L comma 9 it will give true but if we have member L comma 2 then it will give false understood it basically means whether element E is a member of the list L or not >> okay so this was this was basically yeah so this is more or less what >> uh we have here if you go through the uh slides or rather In the slides, if you go through the videos in which the professors are discussing the cards and everything, you will notice that they have talked about a notion of bookmarks also. What are bookmarks? How why do we need those bookmarks? So those are the kind of things which give you the intuition for why lists were required because we needed something uh to be accessed directly.
So that that that is the notion of indexing in a list also. So we can discuss all that maybe in the next class or you will will be able to see the examples in the next class. For now this was week five. If you guys want to take a picture of this please do after this in the remaining 15 minutes I'll discuss some questions briefly.
So I will maybe you guys can take a screenshot of this then or somebody can send it uh the chat if possible.
So this was the f first page or rather I'll try doing it on from my end and see if this give me a second.
So this was the first one.
Okay.
Okay. I'm not able to paste anything here. In the last session, I was able to paste it.
Let me save it and then share it with you guys. Then >> ma'am, could you share this PD yet?
Uh so again this is not a PDF. I have all of them in the same Excal for ease of access actually. Uh so I will share the images of this with you in the chat box. You can save it through that.
Okay. So week five one is there. Let me save all of them together and then I'll share it with you.
This was two and again this will be available on YouTube so you can access it anytime you want two is there and then we have week five.
Uh till that you guys can consolidate your doubts for week 1 to four or basically any quiz doubt which you have.
Let's see how many I can take in the remaining time.
Ma'am, >> your voice is breaking.
>> Whoever is speaking, >> whoever is speaking, their voice is breaking a lot. So, either write it in the chat box.
>> No.
>> Hello.
>> Just give me a second.
Yeah, just give me a second. Let me attach the screenshots that I have taken to the chat once and then take up the doubts.
Yeah. Are you able to see that? Can can everybody please uh confirm if they can see the chat that I'm sending the images that I'm sending in the chat?
>> Yes, ma'am.
>> Yes, ma'am.
>> Okay, I'm sending two more.
So, you can download these images from here. And I hope that would be clear.
Yes. So coming to the questions.
Firstly, can all of you guys raise your hands? I I'll go by in the order of the raised hands because then everybody will get a fair chance.
Okay. So I see a lot of four hands raised. So the first one I see is in the order is uh Shvakant A.
Um set on question number five.
>> Can you send the question in the chat box?
>> Okay. We don't write it. Try to send the screenshot if possible.
Let me see where the chat is. I think somebody has already sent a image in the chat. Sayan patra, right? Let me try and solve that in the meanwhile.
Okay.
So a is th00and while pile one has more cards. Leave the top card x in pile one.
If x dotshop name is equal to big bazar then temp is find item x.
Okay. If temp is greater than a, a is equal to temp move x to pile two and find item is maximum price. Card y has more items.
Okay. So what is your doubt in this?
>> I guess also the increment of uh is initialization of a is also incorrect.
So it should be also marked as the correct answer.
>> Initialization of a is incorrect.
>> Yeah.
>> So the question says uh can you can you show what the question is exactly?
You can just speak it out if possible.
Are you there? S are you there?
I'm not able to hear you properly.
>> Ma'am, I don't think initialization of A is wrong.
>> Can you hear me, ma'am? Now, >> yeah. Yeah, I can hear you. Can you can you first share what the question is? I can only see the options in the code, but what what is it asking? Ask is it asking the correct statements? Is it asking the incorrect or select which of the following? incorrect any initialization or incorrect any line of for the code.
>> Okay. So if for example in line 17 read an item Z from item list of >> I think ma'am line number 18 is incorrect the if condition.
>> Uh why?
because they want to find the which items has maximum amount.
>> Have they mentioned anywhere what they want to find out?
>> Yes. Yes ma'am. In the question. Okay.
>> Can you send the question once? Yeah.
That's >> ma'am. I sent you a screenshot. Can you please check that including the question?
>> Okay.
for me like in my answer key I got a is 100.
Um >> so it it first of all everybody getting different things uh means that you had different sets right so that is okay that is not an issue if you were getting a as something else and somebody else was getting a as something else that is why the answer if you see they're different in different sets so somebody who has shared me the screenshot earlier in that line one and 17 were uh different incorrect initialization of a and stuff like that. So here in this screenshot they gave line one is in uh line one incorrect initial initialization of a but then here a is 100 which is wrong. No so this should be >> uh but the >> it is incorrect like if what if the least bill amount is greater than 100 >> three answer should be for each uh >> number of can can just one person speak at a time please. What if the least bill amount is greater than 100? Then this case will not get will not be considered in this case. No.
While file one has more cards, uh the following suit using shopping bills. So uh can you share? Okay, I'll just try to access it from my site. Shopping bills data set. Some information might have been provided to you about the shopping bills data set right in the beginning.
>> Um this is the question. No, in the beginning uh in uh the initial first question or something right some information might have been provided for sure >> but they also have written a note that this is only for reference and not does not belong to any question they gave a disclaimer stating that >> okay >> and they gave just a sample they do not get give the complete data set >> all right the following this is just the sample reference for a God. Okay.
>> Uh can you please mute yourself? Whoever is speaking, I'm just I'm just going through the question. Give me a minute.
Uh meanwhile, whoever is unmuted, please mute yourself if you don't have an question to ask.
Hello ma'am.
>> Can you hear me?
>> Uh yes >> ma'am I am the first one who sent the first video. I can share the question now.
>> You can share the question in the chat box. Meanwhile I'm going through uh already some screenshot that somebody has shared. Once I'm done with that if it's if it's a different question I'll come to it otherwise I think most of the students have asked this question itself >> no it is different and the questions also the >> you can send it chat you can send it in the chat box because till now I think I have seen only one two separate questions in the chat otherwise it's a similar question sent by multiple people there is one more question that I see in the chat box which has a separate pseudo code that is sent by uh Shervakant A right >> yes ma'am I have >> that I'll go through that just let me get let me go through >> okay let me know after you go through that >> yeah sure so coming back to the first one okay so the ma'am uh The >> yeah go on.
I think the number radika like that who send the uh question like me in big bazard data set shopping here uh a capture the lowest price across all the item purchased but in my questions I share you here a captures the highest price across all the items purchased from bigger >> hey that is what I'm saying right different sets have different problem statements. So not everybody will be getting the same question depending on the problem statement everybody will be getting depending on your set everybody will be getting a separate question more or less it'll be the same but there'll be some nuances which are different that is why the concept of sets is there right in exam not everybody is getting the exact same question the concepts are similar but some values or some maximum minimum differences are there >> yes but according to that the D option is not incorrect. I think >> okay so line 17 in correct conditional statement the thing is I'll have to go through all the pseudo codes that you guys have shared right I will have to go through them one by one and uh try to in order to find out what mistakes are there I'll have to go through uh a simulation or a dry run of these on my end that will take some time and we are already out of time for the session I have downloaded all the things that you have shared I'll go through these question once if not maybe try this course and try to ask this again. Uh if you have already sent the grieviances right some your a feedback form must have been shared with you regarding the quiz. So if you have already shared these questions there then we I already have accumulation of those lists and it is on my task list that I have to go through all of them and figure out if any of the grieviances are correct or not. So be rest assured if the question is not correct it will be uh rectified.
So don't worry about that you will get marks if the question is wrong. But uh instead of trying to solve everything in this particular session I'll need some time and go through it uh go through all the grieviances on my own and we will post an update to you guys soon.
Okay.
Is that clear?
Yes.
>> Yeah. So, uh till now I think only two unique questions have come up, right?
One is the same question in different sets and one is the one that Shvakant shared. Any other questions that you guys have any doubt in or that you have not filled in a feedback form that you have you might have received?
>> So, can I fill it in the feedback form?
>> Uh I'll have to find out where it is.
You can also send it on discourse if needed. You can tag me on discourse. My ID is uh at the rate. So you can tag me there in the city uh discourse forum which is there and uh I'll check that question definitely with the set and the question photo is that clear?
>> Yes ma'am. Are you going to add this? Uh so I was just going to ask whether you had any doubts in the week five content that is discussed today. So I've covered more or less everything uh most of the things that are discussed in week five only the questions or the complicated examples that can be taken up with effect with with uh uh effect from lists are left which will be discussed in the next session. Next session was also week five. Just to reiterate once we discussed why lists are needed, how to form a list, how to append to a list from to the beginning to the end. How to append two lists together, how to use for each, right? Uh we also saw one particular pseudo code example on updating the list and finding the minimum marks. We also discussed some scenarios where lists can be ordered where sometimes where they can can hold no order. But essentially if a list is already given in an order, we will consider it to be in that order. We will not shuffle it. So dummy list one plus dummy list two. We will not shuffle the order randomly. We will keep it in order. That is important. We discussed nested for each. So for each was a way to iterate through the elements in a list. And we discussed how we can do it in a nested manner. Why we can do it in a nested manner. We saw simple code tidbits for this pseudo codes. We discussed what the length of a list is.
The first element, the last, the rest, in it, member. So these five uh utility functions we discussed for lists. Uh I would suggest you to once go through the content, the video content for better understanding. The professors are discussing it in a very intuitive manner. And uh after that go through the slides once and uh if you have any doubt, please ask that in the next session. So ideally what is expected of you is before the last session of that particular week you should be uh you should have already gone through most of the content that is there go through the activity questions do the PAS do the gas and whatever doubt you have till the non-graded part which is there try to ask that in that last session okay >> yes ma'am ma'am I am shan speaking >> ma'am that doubt came clear just uh that I only misunderstand that uh options.
>> Okay. Okay. So, uh again if you put that in the feedback form, we'll consider it.
Uh we'll go through it again once definitely. But uh only if it is wrong from our end, we will be posting an update for that particular question.
>> No ma'am, it is wrong from my end only.
I won't be put wrong.
>> Okay. Okay. No worries.
>> No worries. That's okay then. Ma'am is that big fight deadline is still that 22 only or will be extended?
>> Uh I think it will be I'm not sure about the deadlines to be honest. Those are managed by the operational team. So if it will be extended for all the uh foundation courses only then I think it will be extended but uh since week five had been released earlier only right before week one. So I think >> ma'am but but the previous class just now are only revision for question one not the week five isn't it? Okay. Okay.
I understand your point of view. I'll understand your I understand your point of view. I'll uh I'll relay your query but I can't uh commit on whether it'll be extended or not. Okay.
>> Okay.
>> So any other uh conceptual doubts from week five?
>> Excuse me.
>> Whatever we have discussed today. Yes.
>> Ma'am I want to know whether while processing in a list can can we have a list of elements which have which have different data types.
So ideally when we talk I'll have to to be honest I will have to cross check it once in relation to uh the the current CT course which is there. uh when we talk about lists in Python or in other languages then yes we can definitely have different data types in one particular list that is not an issue because list is essentially a collection of items right so we can have that but in week five at least the content that I have seen we have not used that so in future weeks uh we have dictionaries first I think so I will have to once again go through it on my end also I can't uh I mean surely say which I'm not 100% sure about. So ideally if you talk about the concept of lists in general then yes they can have different data types but for our particular course computational thinking course whatever we have defined our list to be for that I need to check whether we can have different uh data sets or not.
>> Okay ma'am >> if you're aware of any other languages like Python for example then the list concept in Python there are multiple elements allowed in that list.
>> Okay. But in the examples at least for this particular CT course I haven't seen that. I'll have to cross check with the syllabus team once.
>> Uh ma'am can I ask a question?
>> Yeah yeah please go on.
>> Um actually uh when we are initialing minimum uh we need to uh set um initialize to read a large value like uh in larger than the range.
>> Yes. Yes. Uh it doesn't means that we know that there is something uh below the um below 100 uh item price is below 100. That doesn't mean that we will set the minimum uh in uh 100. That's we need to set the uh minimum initialization to the uh range of the price like uh something a big value like uh 10,000 or,000 like this. Now >> yeah. So we we have to be uh so this this is not no hard and fast rule that what range you have to focus it's just one comfortable for example if we know about marks right we know that marks can't be less than zero unless there is negative marking we know that marks can't be less than zero so we initialize it to zero when we have to find out maximum when we have to find out the minimum >> I'm saying for minimum minimum I'm saying for minimum that we need to uh set a large initialization so I'm saying So when we know that marks are maximum 100. So in that case even 101 is okay but at the same time when we talk about price or something like that so the upper part becomes a little ambiguous right we don't know what the upper thing can be. So in that case we try to initialize it to a very large value which is not feasible. So again there is no shortity. Maybe somebody bought something for one lakh rupees that is also possibility right. But at the same time we we try to make an educated guess there that okay since given the data set given the values that I can see right now uh the possibility of getting something greater than this value is very very less or close to zero. So we will initialize it to this particular value.
>> Uh okay ma'am I am saying that uh I know that there is something uh which uh which price is uh near about um less than 100. So that it doesn't means that I will avoid the larger values larger prices so that I'm initializing initializing the to like 100 uh it doesn't mean right now.
>> So if in the given data set you know that the maximum range is 100 only that there is no item more than 100 then and you need to find out the minimum right.
So in that case you can initialize it to 100 and then whatever minimum once the minimum gets updated then we don't care about the maximum value we initialize for right. So if we know first of all that okay some minimum is there and that is okay the uh under the evolution. So we'll get the minimum value after the evolution but we can't initialize to like depending on that particular price right.
>> Yeah. Yeah. We can't initialize to that.
Yeah. Yes. Yes. So if there is any price for example let's say we have 30 50 100 and we already know that 50 is a mid value. We have a value less than 50 but we can't initialize it to 50. Ideally we should be initializing it to 100. Yes, that's why I'm saying that uh in my set there is asked to find the lowest price in among all the bills of big bazar. So there is the A is initialized to 100. So so that I am saying that 100 a is initialized to wrong. We should initialize a to a big value like,000 or 10,000 like this. So that >> it depends on the problem statement.
I'll have to go through it.
>> Okay.
>> Yes. Yes. Okay.
>> In the case that you described, right, that if we have three values and we know that 100 is there, then we can't use 50.
That is for sure. But given the problem statement, I will have to analyze. Maybe it was a typo from there and I'll have to check. Maybe they meant it to be thousand and it was 100. So that that might be an issue. I'll go through it once and we'll update.
then um I'm saying the summary that if I have something which is value is near about 1,000 or 600 like this then we need to uh we need to initialize the minimum value uh at firstly like 1,000 or more than thousand uh am I right?
Yeah. So, whatever is maximum in the data set, ideally it should be greater than that.
>> Okay. Thank you. Thank you.
>> Okay. Thank you. I'm closing the session. Hope week five is clear to you all. So, till for the next session, just go through it once on your own also and then bring up any doubts that you have in week five. Thank you everybody.
>> Thank you ma'am.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23

Bitcoin Social Interest: Dozens of us Left
benjaminjcowen
12K views•2026-07-23

Tesla Profits Plunge & SpaceX Stock Continues Fall
TheJohnJohnstonLounge
6K views•2026-07-23