uh good evening everyone yes good evening yeah how is your python pration going one uh good bad normal normal sir noral okay so today we will cover week one to week four Concepts and Saturday uh tomorrow there is an instructor session make sure to attend it and on Saturday we will solve some pyqs I mean previous term question papers uh is that okay yes sir okay so let's wait 10 minutes and we will start covering week one to week four Concepts we will start the class at 510 e e e e e e e e e e e uh wasn't this python ta session in Hindi yeah uh today's session a is to understand Week 1 to week four Concepts I mean revising the concepts so 4 minutes to go after that we will start revising Week 1 to week four Concepts e e e e okay guys let's start uh okay I'm sharing my screen so how many of you done with week four raise your hands if you have done week four okay one only one okay that's s okay let's quickly cover week one Concepts week one is very easy as you know it is just printing variables so you can use this built-in function called print and whenever you pass uh whenever you pass any string or any valuable value inside it it will print the output in the terminal that's the use of the print building function and you can also pass variables don't have to pass value directly you can pass the variables and python will uh using this print function it will print the variable value and we can take inputs from user also so it is printing the input this is how we take input by using input buildin function and we can put we can pass a string uh by using this syntax F string and we can uh insert the value of a variable inside a string so your name PES so hello PES hello P so these are two way in these two ways you can uh insert a variable in into a string this directly printing whereas this is making a string uh and so there is a separator in Python function there is a uh uh how to say you can give a value called separator so whatever you define it will print it will print uh uh the comma separated values in the print uh arguments by this separator so if you print star it will sub it will print the values using this operator so default value will be space so you don't have to mention anything even if I put step equal to empty string or if I don't even if I don't put the value will be same so hello space Nandan and if I try to print it now hell space so the default value will be space you don't have to unless you want to do something new then only you have to use this operator comma I mean any value you have to put that you want to have so right now we added comma so that's the use of this operator and okay uh in order to put print multiples multiple values you have to do this or else you can directly print the variables using commas in a single line and separator you know default value will be space only unless you want something new you can have to Define it so it us it used the separator and there is another thing called end and some uh called end so if you want to print something at the end then you can use this end operator uh end keyword and you have to give the argument any value and it will print at the end this is end one this is end two so it will print there uh the default value for the end will be sln that is new line keyword if I try to print this a printed hello and after that the B printed because the default will be new line we are overriding with this string it is not a new line so it won't print the uh this C in new line it will attach that to the B uh that's the use of this end any doubt with this end in in exam I don't think they will ask any questions related to this end but in op you may find it useful while solving some questions you have to print customly uh is it clear yes sir okay so so this is the end of the line you can add anything at the end of the line so handy tool so just remember and S equal to 3 and Nal 3 type of okay so this is string input and string value and this is input integer value there's a float value if there is a DOT between numbers in uh numerical value then it is float and addition subtraction multiplication division Flor division remainder power I hope you all know this I don't think I need to uh revise these things I'm skipping so name age uh in order to print like this you have to use commas or else you have to do use f strings to include variables in a string and if equal to none another FL it is taking input high so string input could not convert string to float High okay so 3.41 so it is a class of string after that we are converting to float using this float operator and after that it type became float class and after that it is adding again 3.14 sir how can you Rectify error so fast sir oh okay so okay first understand the code F equal to none f is empty after the time printing F and type of F and after the time taking input and overwriting the F value after that I'm printing F and type of f after that I'm converting the F to float okay after that I'm printing that F and type of UF and I'm adding 3141 to that so if I run it it is asking for me input right now it is n non type object so if I try to print High I mean I gave input high so it will U rewrite the F equal to n to F equal to string of high but this F equal to float of f it is it is trying to convert this input into float right but the input I gave is string that is high but it is characters it can be converted to uh integer or string uh integer or float here we are trying to convert to float so could not convert string to float hi this self expl we just need to have some so right now I got this error next time I won't repeat it because I understood know that's the thing yes s so now you got this error right so again when you got the same error you will know okay could not convert so I uh maybe I'm giving wrong input like that you have to understand and move on that's it sir mhm what's the use of non type non type when you are uh when you initializing something some variable but you don't want to fix anything then you have to use non type so if you want to find max value uh you can take first one maybe when you are defining a variable but you don't want to give any input to it any value to it then you have to use n type let you can add whatever you want to that F got it sir double inverted commas space double inverted commas that also means none sir uh no no uh in Python uh empty string is considered as false okay let's check print equal equal to none this is what you are saying right okay yeah it is false because this is considered as false but if I remove none and I put false then it may become true oh false okay uh if false print I uh maybe print false F false is false if empty string print is false okay nothing is printing but why not equal to equal to false yeah that's okay maybe in conditional statements the empty string is considered as fault but it doesn't literally means false because we are checking the value right this thing is evaluating to false but it doesn't means it is false got it here this equal equal equal operation is checking the uh type of uh the variable and also the value is same or not it is type is very different right so I don't think it will equal to got it uh is it doubt clear yes sir okay so that's it uh sentence equal to okay you can have multiple sentences in a stringle line using the Slash and if you define the Slash and it is a new line character so it will print the line in multiple lines but if you don't want to use this then you can use this triple quotes and you can uh you can put anything and you can press enter and in new line you can Define so it will become a string you don't have to explicitly put this backward slash and in order to define a new line uh in week 9 or 10 there will be file hand link maybe in that you have to use this back backwards slash and in because you are writing something in the file and uh if you want new line then you have to add end of this right now just for the exam purpose op purpose thing this triple quotes means multiple multi-lined sentence uh so in Python we can uh string string also we can access each character in the string using the index so python uses zerob based indexing in order to access the first element we have to use the zero and this is a syntax to get in the character in in a string or any itable uh so this is the thing first you need to define the variable and after that you have to put the square Braes in that braces you have to give the index and it will return the uh the character at that uh is this inter instructor session no this is a TA session and we are covering Week 1 to four uh rision session okay so python sir uh usually instructors will take this uh revision session um no no maybe on special demand they will but TS will take most of the time EXC sir sir can you explain the question which I have pasted in chat box sir okay okay right now let me cover this week one to 4 okay that's the uh agenda of this meeting at the end of the session you can ask your question okay thank you sir so if you want to get n position element you have to give the N minus one as argument to this square bracket and it will return the uh character at that position and you can also use negative indexing uh which will return the elements from right side to left so left side to right you have to use 0 1 2 3 and so on from right side to left we have to use negative 1-23 in order to get the elements and there string slicing we have to use this colon to slice a string so this minus 3 and colon uh so colon left side whatever we give it is a starting point and after that it is the ending point so right now this minus 3 telling that third element from the last so it will take third El from the last and after this colon it is like take the rest unless you define minus one it will take third last last third element and the second element and it will avoid minus last element so PL if I don't put it it will take the rest so whatever there is on the right you take it like that and there is some skipping if you put double colon it will take it will skip the character so uh word of colon colon one it will take every first character colon colon 2 it will take every second or here and after that this colon 3 third ones so one 1 2 3 so L and fourth one it will take first one and then fourth 1 2 3 4 so like that and the one will reverse the string so this is the thing you have to remember for op uh in order to reverse the string this is the better way to do it or else you have to do for Loop and reverse indexing and going from uh n minus one to zero so instead of you can just use this thing word equal to word of colon colon minus one so it is a easy way to reverse a string and this is reversing and taking every second character and so will it work for list also list also okay I haven't tried it let me try uh list equal toal to uh Lial to Li of colum colum minus yeah it is okay let me check yeah it is working it is work so you can use it so this string slicing again so we are slicing and I mean if you don't specify anything it will start it will start taking from zero index and till fourth so 4 - 1 3 it will take 0 1 2 3 so till L it is taking and we can multiply any string with number and it will repeat that many times so apple apple apple five times and lenov word so Len is a inbuilt function if it pass a string variable string valued thing into it it will return the how many characters in it and there are also built-in methods for uh the string so do upper will convert the word to upper case lower will convert to lower case capitalize will uh make the word capitalize only starting letters Capital after full stop Capital something like that and uh so there are some questions from uh practice element so so what will this eval result what will be the value uh final result type of value of the final result so here we are using floor Division and there is no float so it will return integer uh this is string of course double quotes and this will return return in float because there is a only slash and the slash will always return float value and 5 is greater than three it will evaluate to true and also false true and false false so it will return return Boolean and 20 into 100.0 divide by divide by 11 modul 5 so it will return return in integer no yeah it will return in float I don't why I don't because 100.0 there is a uh it is a float and whenever we multiply with and work on it it will always result in float so it is float yeah that's it and so e equal to false not of e not of not of e so this pattern will repeat so we we just the thing we have to check here is for odd case it is printing true for even case it is printing false so uh for the nth uh nth step what it will result so we just need to check if the N is even then it will surely print false else it will print true that's it uh uh so uh another built-in function or so if you pass any character uh to this OD it will return the uh numerical value for that uh character so or of any character so empty string also character no yeah expected a character we had to define something here so empty space so space is also character it is uh its value is 32 uh what about one two okay we we have to only pass one at a time so one is also a character I mean string valued one what about normal one okay I expected string but in found so maybe only characters it is having uh odd values okay let me use this one so Alpha equal to a to J for I in Alphas print I comma order of I okay let me print this so cap small a value is 97 capital a value is 65 you don't have to reme remember these values uh maybe in op if you get any uh questions like convert uh a string into a secret code by shifting those alphabet syex to the five positions Maybe in those type of questions you may need to use this odd function and in order to convert the odd values into a string we have to use the CHR function so this will be useful when you are going to the op right now need to worry but maybe in exam if they ask just think like ODD will return the value of the numerical value numerical representation representation value of a character where CHR will convert that value into that character that's it so 97 will be converted to small a 67 will be converted to Capital C 101 101 converted to cap Small E don't remember values just remember the functions OD will return order of character CHR will return character of that ordered number that's it uh so sir is it ask value ask value I think uh these values will be used in memory to store the variable uh got it oh so the these numbers are ask codes right the address of yes sir in Java Java also sir okay okay I am not sure but the thing is uh these are used to store the values in the memory okay maybe it can be okay let me just Google is OD return ask values of char yeah um python OD converts the given string of length one returns an integer representing the unique code point of the character for example all of here Returns the integer 97 yeah yeah it is ask value and that's it about week one let's go to week two any doubts in week one sir how do you take a Boolean input Boolean input okay uh I think it's in week two but let me tell it here only uh uh in put equal to input of true or false and after that uh if input print through else print false this is correct right so let's run this and check so right now I'm putting false so false should be printed but the python will take any input and it will take it as a string value so it will even though we are giving false it will print true only so in order to avoid that we have to do is input equal to AAL of input uh string object is not callable maybe we have to give underscore because uh input become a string because we are using the input so I'm just differentiating it by giving another okay okay maybe I have to delete because the input uh variable name is I mean it took the value of the string so maybe I have to delete that from memory then only I can do it delete input okay it is deleted now I can run again yeah now there is no error so remember guys uh don't use buil-in function or method names as variable names okay whenever it got the value maybe in line by line interpreter um how to say uh maybe in a script it won't cause any error once you Rectify but in this collab files the value will be stored and if you try to run it again this will cause an error and we don't know what there we did so it will consume a lot of time so to generally to avoid that just use unique value variable names so right now I'm putting false and it is printing false because this converts the uh input to python data type matching data type because it gave as false it evaluated to false sir what you have done before sir some delete memories or what process sir yeah let me tell okay false okay this bull function won't work to convert maybe we have to use eval only okay when it comes to so right now I'm using the variable input to take input from a user but input is a built-in function right yes no maybe yes sir input is a buil in function yeah so this input value value taking the output from the input buil-in function so after that input the the keyword input becomes a variable so if you try to call okay let me check this so right now ran it so it is working fine so I gave false and it printed false because I'm using a Val it converted the string false to Boolean false but if I try to take input again uh input in equal to input but the input keyword became a value how to say it is become a v variable keyword right so if I try to take input you input so it will give error because in memory the input this is considered as uh a variable name because we have used it here so in order to avoid this better to not take the variable names as buil-in functions take something new so in or else we can take input only but underscore like that you have to differentiate that so it will be better in exams so input of underscore and if input underscore right now my memory has the input as keyword uh value variable value only variable name only so I can't call The Bu object is not callable so I have to delete that from memory so what I have to do is I have to use Del keyword and then I have to Define that input so from memory the input keyword will be deleted and then I can use this default function that is input got it yes sir yeah so this is nothing but deleting whatever variable I created so don't use the important thing to notice here is don't use inbuilt function names for variables that's it so week two okay we have spent so much time on week one better to know it is connecting connected so variables there is a integer variable type string float Boolean are easy and we can uh change values of a variable by again defining the assigning it X = to 5 and x = 10 we'll change the value and in order to delete a variable from the memory we have to use D and we can pass any number of arguments after space that's what I did before deleting that from memory so in um in collab like uh these python files Del will be useful to delete one thing which is defined at a time but in scripts generally we don't delete keywords we don't need to delete variables from the memory because the script will execute at a time and it it won't be stored so no need to worry and variable swapping so traditionally we use temporary variable in order to swap values of two variables but python has uh a easy syntax that is this x comma y = to Y X so we reassigning the values and X will take the value of of Y and Y will take the value of x got it got it sir yes sir so this x comma y comma X will create a triple and it will unpack the values oh sorry someone was saying something hello okay so that's it uh it is X comma y equal to Y X it is creating a tle it is equivalent X comma yal to Triple of Y Comm X it is equivalent to that uh no need to worry just understand the syex maybe there can be a question on this swap variable spping so just understand this concept and try to uh make your own some program which will do this spping and to pull off 1 comma 2 y comma X comma y equal to Tuple and I'm deleting the Tuple but the values of X comma while will be still be there because um uh X and Y are copying the values from the Tuple so there is it is not directing to the pointers it is literally copying the values so even the even though Tuple is deleted the value still be there will be there okay let's go let's go to conditionals so what are conditionals conditionals in Python allow you to execute specific block of block of code based on certain conditions the primary conditional statements are if elephant else so how to say so you went to a person and you want that person to give keys only if Ganesh arrives uh ask that person so what will happen whenever a new person arrives to him he will ask what is your name if the person name is Ganesh then will then only he will give keys or else he won't give to anyone so it is like that X = to 10 if x is less than or equal to 10 we are printing X is less than or equal to 10 since X is equal to 10 this this becoming true and it is printing this if I put 9 yeah X is still less than lesser than 10 so it is printing this line if I put 11 this condition won't become true and it is printing nothing so xal 6 if x is greater than 5 X is greater than 5 else it should be less than or equal to so that's the only way so since X is equal to 6 x is greater than five if it is less than five that is one it prints the other one X is less than or equal to five so even even if you put five the second one will become true X is less than or equal to true so for that we can again uh separate that so if x is greater than 5 we are printing X is greater than 5 if x is equal to equal to 5 then X is equal to 5 else else means whatever the condition I mean else means what will be the possible X should be less than five there is no other case so X is less than five in that case we have we have to print this x is equal to 5 okay - 300 x is less than 5 that's it and here we are taking a input from user and after that we are converting to float and after that we are checking if score is above or equal to 90 we are printing grades uh these are just conditions and printing the grades that's it nexted conditions you can give a condition in another condition so instead of doing this if x is greater than five and if x is less than 10 we can just simply Define uh and and contr C uh instead of doing this long thing we can just put and and this and will take both LHS and rhs evaluated conditions and it will uh make a final one so both are equivalent instead of doing Ned Loops we can do this simply putting and keyword between two two conditions condition statements got it yes sir yeah so multiple conditions yeah you can Define one if age is greater than or equal to 18 and age is less than 60 then only age of a person is adult uh so there is other keyword or so here the both should be true then only we want to do something here anything is okay for us so in that case we have to use R so we are taking age and is member input if it is yes or no so we're just checking if a is less than 18 then they are eligible for discount if age is not less than 18 or is not a member then only we have to say you are not eligible so if it is a member and age is above 18 then also they are eligible for the discount so uh the key thing is the r keyword is used to check only one condition we want if the if it is matching only one condition then we have to allow in that case we have to use all that's it uh so the same thing again here we are checking a is greater than equal to 18 and age less than 60 instead of that we can simply put age uh 18 less than equal to age age less than 60 so this is like bounding the variable range and if it is between them then only it will become true and it will uh become true so is ring equal to false if it is raining you need an umbrella if it is not raining then you don't need an umbrella so this is the Lal meaning so if if it is raining then it will print you need an umbrella if is raining is false then we don't need an umbrella so this is the best example to understand if conditions and it comes to debugging uh this is already done guys there's nothing to do I will just explain the quotes we are taking number and we are checking if it is greater than five we are printing greater than or else number is five or less and 25 allies uh string of a we are just printing that uh any doubt guys what we have to do here sir no I'm just explaining the code what I doing here is I took the a in order to add it to a string I'm converting this integer is to string by using this string of or function no debang gim I mean so this already rectified uh we practiced this in another session so there is no errors in this course all are working fine okay the purpose of this was to just tell the students how to debug a code but for exam point of view just understand the code no need to worry sry about debugging okay there there may be some questions where there will be mistakes and you have to rectify it yeah so so the list will come in week four temperature greater than or equal to 30 it's a hot day or else weather is coold if denominator is not equal to zero then only we are dividing or else we are printing denominator should not be zero and City equal to Parish if City do lower equal to equal to Paris so we are just checking because the this p is capital and uh the already the checking value is small so in order to avoid this uh typ uh capital letter small letter mismatch we just converting the input to small lower so it will check easily fix it and age salary age greater than 18 and age less than 60 eligible to work so just if conditions let's go to week uh can we have this collab yeah I will share the folder um okay let me go with Qui three so what is while loop so while loop in Python allows code to be executed repeatedly based on a condition so whenever a condition becomes false then only while Lo will exit that's the main uh use of while loop it is useful when we don't know when we are not sure about uh when the loop should mean when a block of code should stop in for Loop we will know okay uh in the range of 1 to five do something so we know exactly five steps it has to be executed but in wi Loop we are not sure so that's the use of wi Loop and the loop continues uh continue to run as long as the condition remains true yeah we don't know Advance how many times you need to execute the loop so condition equal to True while condition print hello world so this won't become false so it will keep executing and it will uh it won't stop unless there is external Force like python will stop the code executes for a long time because uh there is a some if conditions like to check if the user made a mistake in code like that if it is executing for long time so it won't stop guys it will keep running so maybe better we should stop it interrupted cell yeah it is interrupted is a infinite Loop right yeah yeah infinite Loop so I'm clearing the output so better to not do this in Old Computers it won't stop and maybe it may crash the computer better to not so just be careful while putting while condition uh uh make sure it will stop at um at any time so here count equal to Z while count less than equal to 5 then we we are printing count so it is printing count zero count 1 Count 2 count three count 4 count 5 whenever count become six it is stopping because count is Count should be less than or equal to five so here we are incrementing that so if you don't increment it uh the count will become count will be zero and the loop will run continuously so we have to make the count something so that this condition will become false so what will make this count uh this this statement false can anyone tell when count is greater than yeah five is so what is the minimum value uh to make this uh this statement false minimum value yeah okay six will make it so that's it guys uh in the exam there will be some questions like uh we are printing before and after incrementing maybe these things you have to be careful so if I first increment then I am printing it it is printing 1 2 3 4 5 six so when the count is zero but if I do this incrementation after printing so it will print from zero and it won't print six so just uh make sure to write down every step in exam in order to avoid confusion okay sir yeah can we increment the variable in list comprehension increment variable can we uh increment in in list comprehension uh list comprehension you're just looping through a list so how can you increment no I think he wants to ask how to write this while in list comp no no he's asking how to do incrementation in list comprehension uh can we write this uh using list comprehension uh xal to uh count X into count okay yeah count and then while counting no he's asking for while if we can use while here yeah no no comprehension there is nothing like while okay let me search I don't I'm not sure I I never heard so maybe it is not there let me check uh one question brother uhhuh um in exam uhhuh will we be asked about the functions like many functions we had to use in the grps which were not explicitly there in the courses can you give me an example like there was one in week four grpa I think um one ta used is instance of is instance of yes like I think there was some if if condition that we had to check that if the current input is a list or set MH so I think that can be that could have been done with type like type of yeah I'm also not aware of ease instance so I will also use type uh okay can you tell me where exactly he used e instance of no not grpa 1 okay um I mean can you tell me where he exactly used it like first first grpa I think first grp of week four he used it to check if the current so parameter is a set or not like it was a function where type of right type of yeah we can use type also okay um L equal to list if let me print type of get a class list uh if type of Li equal equal to list print is list no it is not printing type off is not working maybe we have to use the E instance of something yeah if you write instance of is instance of AI comma list is instance no there is no underscore instance there is no space one word is instances together okay is instance of um I think o is also there if I'm not wrong no no o is not there just okay so lii comma comma list yeah this has check if it is no not colon l no no not not string it's a ke yeah not colon It's comma L the word itself Comm a list okay we got it all right yes this checks if all is a list or not of typ list list so I have never used it uh we can do type of yeah this is working guys type of Li equal to type of empty list uh okay but I'm asking that if in exam can we be um at least 9 is not mentioned in the any of the videos then I'm sure you can raise that in this course like this not there maybe they will give some Grace marks for these kind of questions if the topic is not covered most most probably they will they won't ask these kind of questions for sure okay like they haven't asked the anything like that in the practice quiz that we got uh in previous question papers I'm I don't think so okay even if they use new functions they will explain what will the what the input it will take and what is what can it out give output so you can use that if something not taught in lectures they they most probably don't expect you to answer for sure okay sure yeah so this is another function another code which will take user input and while the user input is not exit it will keep pass the user to input something so print something uh uh input something so it will keep running unless when you when the user gives the input exit then only it will exit so these kind of uh places where the V will be used in mobile games even the mobile soft sofware the V Loop will be continuously running in the back end uh so mobile will be active all the time so whenever you press the power button it will turn on the screen if and only if you switch off the mobile then only this V Loop will exit or else mobile will keep working in background that's the use of f Loop and so there is a keyword called break so it will exit any Loops uh you can use this in while loop for Loop it will break break means it will completely exit the loop it won't do anything further in the block of code so whenever the count becomes five it is breaking so it is not printing anything so incrementing by one so 0 1 2 3 4 whenever it become five it broke it but if I put three uh count won't become five so this ex this block of code won't be executed and the code will not break if I put two so it also not become it is also not becoming five here if I put uh 3 four five maybe five yeah it will break whenever the code becomes five it is breaking also whenever the code becomes five that time also the count is equal to 10 not less than so it will become false and it won't execute so continue so continue keyword is used to skip the rest of the code when the condition become true so whatever uh whereas break will come completely exit the code the continue will only exit the current iteration till that point so it won't execute the rest of the code in that block so that's it so here the count is three and we are incrementing the count if the count is three then only the continue is executing so it is not printing that so this count is count it is not printing so whenever the count is three it is not printing count that's what it is doing but it is printing four and five whereas here it is completely breaking so let me hide this and let me break it so it will print one and two only so it break Wills completely exit where continue will skip only the current iteration got it where pass will just a keyword to do nothing it will sit like that do nothing that's it got it guys uh no doubt here hello yes no okay so factorial factorial um is the product of all positive numbers less than or equal to n for example 5 factorial is 5 4 3 2 1 product so we can use while loop to create find the factorial of a number while the number is greater than zero we are creating a variable called Factor fact and we are multiplying that number to that fact and after that we are decreasing the number so whenever the number becomes zero we don't want to multiply in that case so we are just exiting the loop and we are printing the factorial so that's the a of this uh when n is five the factorial is five n become four the factorial 5 into 4 20 uh 3 into 20 60 60 into 2 120 120 into 1 120 that's it so we don't even check for one so we can put 10 greater than one that that will also result in the answer got it guys so what is for Loop let's go to for Loop so a for Loop in Python is used to iterate over a sequence like list triple dictionary set or string or other iterable objects so if there is any itable object we can Loop over that uh it is great for running a block of code for set of set number of times or for iterating through the elements of a collection so here we know how many times we have to execute that so in this case we have to use for Loop where while is uh whenever the condition becomes false then only will stop here whenever the ites uh becomes empty I mean we have gone through all the ibles then only we will stop here so this for Loop is more predictable than while loop so items equal to you can put any type uh any different types of items in this items data types in this items and we can use for and the any variable name you have to give for specific instance and in items it will Loop over the all elements in this items and it will print them so we can also print every character of a string by using for Loop for X in string of python it will print every character of the string Python and we can also do the range range of five will return a list of integers from 0 to four and we are iterating that list that's it and break uses here whenever the becomes five we are breaking it it won't execute further so 0 to four only when it become five it broke continue so it will skip two that's it it won't print number so 0 1 No 2 3 4 that's it Ned Loops we can do Ned Loops for I in range of three for J in range of five we are checking if whenever J becomes three we are breaking so we can do Ned Loops that's it that's the purpose of and whenever J becomes three it is not going further it is only breaking inner loop that's the thing we have to remember uhbe I have to write it here when J becomes three it only breaks in the loop okay find the sum of all numbers in list to in order to find the sum of the all numbers in a list we are we need to just Loop over all the items in the numbers and we need to sum that to the sum of numbers variable and that's how we can find the sum of uh numbers in a list and we can also use index in order to find the sum of numbers in a list by uh going through each index and accessing the element using this syntax that's it and we can also use while Lo so here we just checking if whenever the list becomes empty then stop the code or else do something so in this something we are just summing the first element of a list and we are uh slicing the string uh stting the list by removing the first one and uh making the numbers a new list and this will keep running and whenever list becomes empty then we will printing this sum 115 and we are using another V Loop we are trying to uh uh add the numbers from right side to left side by using index so we are decrementing the Len of numbers whereas this block is we are incrementing it so we are going from left to right so these are two three different approaches both all three of them will result in sum sir we can use some function yeah you can use that but the purpose of the iteration and Loops is I mean the purpose of learning loops is this only to understand how it is working okay if you know all how these three methods are working how these three logic U logic behind these three quotes are uh then it will be easy for you to Define anything so you can use sum also sum of numberss so 115 but better to do in this way itself for learning purpose in op you can use some off if you know how to do this the good thing is learn the logic that's it okay let's go with week four yeah we three any doubts guys no doubt sir in week three yeah so let's go to week four so week four there is some more content here uh so what is list list in Python is a collection of items called Elements which can be different data types so you can put any type of data types in the list so list or lists are ordered there will be order in list mutable means you can change them and you can also allow duplicates in them so we we are defining mty list and after that we are defining a list with integers mix to the list we can give multiple uh different types of data types in a list and all them will work to many sessions okay okay connecting this okay guys uh they connected um accessing listing elements so we are using we can use the uh index zero based index to get the nth element so in order to get nth element from list we have to do n minus one as input to get the n n item in the list negative indexing so in order to get in uh items from the right side we have to use the negative one so negative one will return last one negative will return second one from the last and you can modify the items in a list my list of one will equal to some value will replace the element at the one index with the value whatever you are assigning to uh so list has some methods so do append so it will add an item to the end of the list so if you do my list do append G it will add the grape at the end of the list if you try to insert using this insert method and and if you give uh the index at which you are trying to add and a value then it will add the value at that index so dot remove will remove the first occurrence of a specific value so if you try to remove orange it will remove the orange from the list so my list. pop removes the last item remove will take an argument whereas pop will remove the last element it won't take any input another useful methods do sort So based on the value uh the list will sort the values in them if use dot s do reverse will reverse the list as someone said before uh as we used square bracket colon colon minus one to return reverse a string we can use that same for list also and buil-in function Len will return how many elements in that list so that's it you can see here do sort sorted the 1 31 422 1 2 3 4 and after that we are reversing that 4321 and after that we are printing the length of better to remember all these things methods uh for Loop through a list yeah you can use forloop to print through the items in a list okay okay uh now let's understand sets so set in Python is a collection of unique un unordered items so when compared to list sets or do not allow duplicate values and the elements are unordered there is no order in sets uh sets are uh useful when you want to store data without duplicates if you don't want to do duplicates if you don't want duplicates and you want to perform operations like unions intersections and difference between group of data then you have to use set so you can use the curly braces or set of function to create a empty set so my set equal to 1 2 3 4 and my empty set equal to set of this so it will create empty set or else you can also use this curly braces to Define empty set and mixed set equal to one comma string of Sir yeah oh sorry yeah uh okay let me check I'm not sure yes sir I think empty dictionary okay insert equal to print type of new set yeah it is Big sh okay uh what if you put comma Insite okay syntax uh one okay so yeah this is not empty set it will give uh dictionary so one thing about dictionary is in dictionary the keys are stored as a set that we will cover when we go through that peek which has the dictionary Concepts so we we should not use the empty empty curly bra to Define set so we can create set using curly Braes with value we have to defend here s or set function yeah now it is one okay uh if you try to create a set with duplicate elements python will automatically remove the duplicates so in dictionary also the key should be unique there should be no repetition uh that's that's why dictionary uses this set to store the keys so if you try to give multip uh same valued uh items in the set it will take only one of them so 1 two three though we are giving two two times it is giving one time only so in order to assess an element yeah so what if we give two and 2.0 yeah both are different data types so oh okay no it is not uh allowing 1 2 3 2.01 the new learning so 2.0 though the data types are different the value are same so python is neglecting the value so remember guys uh accessing element so in sets the items are not ordered so we can't use index to get an element the only way we uh we can check if a uh an item in the in a set is or not we have to use the in keyword if two in the set then it will return true if it is not there then it will return false so 1 2 3 there is two so it is returning okay let's check uh my set of one uh set object is not sub uh subscriptable okay we can't get element by index the only way is we can do in and when it comes to adding elements uh if it there is uh methods do add and if you provide a value in that it will add it my set. update and this update will take a list and it will add the all elements in this list into the Set uh do remove uh so you can remove element from Set uh discard okay so dot remove will try to remove the element from the list or set on whichever you are WR running it but the thing is if you use remove and if you passing some element which is not in the list then it will throw an error it is not there so if you want to regardless of if it is there or not you just want to remove something then you have to use this discard function so if you try to remove three if it is three is not there then it will return error because three is not there but if you use discard three if three is not there then it won't throw any error that's it sir dot yeah can we use pend and remove and discard three uh words to list and sets for both list also I think you can yeah list has open yeah I'm sureal to 1A 2A 3 uh do but does List have ad add I'm not sure ad is only for set I guess yes yes add discard these are for yeah 1 2 3 4 and lii do add of three yeah it is giving error here only cannot assess member add for type list add is unnown so there is no ad for list I like okay here you can see whatever uh the methods are for this list upend clear copy count extend index insert pop removes reverse s so feel free to explore so let my set. Discord 10 so discard won't arise the error that's the thing and because sets don't have indexing it will randomly remove an item whereas in list it will remove the L element if you try to pop but in set because there is no indexing elements are random it will randomly remove element any element so there are some set operations Union uh you can do by this set 1 equal to 1A 2A 3 set 2 equal to 3A 4A 5 and Print set one and the standing line which will do Union and the output will be this and UND operator which will do intersection okay let's do how to do this do Union print set one do Union of set2 yeah okay so this is other way what about print set 2 do Union of set one okay both are working uh so intersection we have to use and okay for Union we have to use this standing line keyword to Union uh the two sets or else you can do dot Union um for intersection we have to use and both common in both so it will return return three set one has set one and set two both have three in common so it will print three and difference you just minus no need to remember anything and for symmetric difference excuse me sir here in difference um there is one function like like this I think this ta told us do difference underscore update like underscore update yes like set one do difference that's a DOT update okay okay it is nothing but removing that element right yeah it will um also update set one okay is is it thought in videos no okay then better to not use you what you can do is set one equal to set one minus set one do remove set set three I mean if you have this uh uh how to say in exam you have to do like this uh if you can use Google then you can just search Google and do this when you're are working on a project that's what my session don't try to remember more things this thing like this set one minus set two it doesn't um I mean update any set one or set because we are not assigning to anything we are just what is output okay yeah okay symmetric difference so this symmetric difference what it does is not common elements in both of the sets that's it and these are the things just remember and try to solve the graded assments you will get to know looping through set you can Loop through items in a set uh that's it for item in my set it will print item uh sets are excellent for tasks where you need to ensure no duplicates or perform mathematical set operations like Union or intersection however remember that since sets are unordered they are not suited for cases with the order of elements matters so just solve problems and you will get to know where to use where not to use that's it okay let's go to tuples so Tuple in python is a collection of ordered elements uh compared when it comes to list and compared to list tubles are immutable so we can't change them once you create them you can't modify add delete anything elements inside it so you can modify the state tbes are useful when you want to store a collection of items that should not change throughout the program so it is like something like constant so creating a tle if you want to create tle you just want to use this empty Cotes uh empty uh empty braces so myle equal to 1 2 3 4 mix tle you can also have multiple data types and without parenthesis also you can do this optional but if you defining multiple variables another triple comma X comma y then it will not be a triple it will X and Y will copy the values two and three only if you do single uh value equal to multiple uh values separated by comma then only it will become a tole this is clear guys uh single element tuples so if not not a tuple so this uh braces with value one will be considered as one only if you want to make a triple with only one item then you have to Define this comma if and only if you put comma then only it will become a triple same as before before when we tried to Define empty uh Set uh it cons the python consider as it as a dictionary but if you put one then only it is considering as a set so same here if you give uh empty curly Braes and single value unit the python will take the value only if and only if you put comma then only it is considered as a tle that's it so assigning elements uh as elements so it is same as list but the only thing is uh you can't modify it that's it so you can access elements using zero based indexing same as list so myle equal to apple banana cherry and you're trying to access it you can also use negative indexing so you can also slice the Tuple but you can't update the Tuple U so mle equal to 1 2 3 4 and you are trying to slice it and it will print the output but if you try to change the values in a tuple my tle of one equal to Orange it will give an error Tuple object not does not support item assigning assignment but you can update my Tuple equal to my Tuple of 1 to 4 1 is to 4 so you can slice and update the variable name but you can't modify directly the Tuple uh Tuple methods so Tuple has do count so it will count how many list also has this method let me check uh equal to empty list li. count yeah there is a count for list also so it will count how many elements in that uh whatever argument we are giving it will check how many times it is there index so triple also will return index same as list so there is nothing difference between list and tuples un only thing is we can't modify the elements in the L Tuple once we Define it so why use tuples if you want to ensure that data cannot be modified tuples are good choice so it is faster than list since tuples are immutable python can optimize their performance better than list dictionary keys tipl can be used as keys in dictionaries while list cannot since they are hashable can be used as keys in dictionaries okay okay so we can use the tles as a keys in dictionary we can't use list because they are changeable what it means is in in dictionary when we are defining a dictionary we can use tuples as a keys because they are not modifiable but if you modify a key then there is no meaning of a key it should be something once you define it should be there because of that reason we can use triple as a dictionary key but not relish so triple yeah hashable meaning hashable means something uh since dupes can be changed list you can change so once you hash some hash something value it will be unique okay but if the value is Chang the hash will change uh sorry sir I think it means immutable it won't change tuples cannot be changed tuples are immutable while lists are mutable so when you try to make a hash of a something it will be unique representation of that but if the value is changed the hash will also change so it will cause uh issues in dictionary okay that's why we are not using list as key okay right now don't worry dictionary is not introduced to you so don't worry about that I just told you because it is there uh triple packing and unpacking so if you are defining a variable and you are giving 1 comma 2 comma 3 and it is packing so it is making a triple of 1 2 3 into this my triple whereas a comma B comma c equal to my tle so if you define like this then it will unpack the uh values so a will take one B will take two c will take three that's it uh looping through tle you can also Loop through Tuple same as set we can look through tuples okay that's about list Tuple sets uh let's go through list comprehension so basic syntaxes you have you have to give expression for item in itable if some condition is there so let's go through examples squares equal to Mt squares for I in range of five we are appending this square of the numbers we are printing squares so instead of printing uh doing this three lines we can just do this in a single line so squar is equal to I whatever expression you want to give here and we need to Loop over the range of five so this will save the output inside the list that's it so this is list comprehension so it will save your time instead of writing this which three lines of code you can simply put it here also you can have if conditions inside the triple uh list comprehension so here we are looping and we are checking if the condition matches then only upend it instead of that we can use lift comprehension I for I in range of 10 if I modu 2 equal equal to zero then only add I so like that so we are looping through uh in range of 0 to 9 and after that we are checking if I mod 2 equal equal to Z then only we are adding I that's it so yeah can we two expressions in com yeah you can give two expressions what do you mean Expressions means the body of the you mean two conditions for two values not not conditions um the values okay you can do something like this you can create a triple I into iar 2 so you can Define like this so it will make what it make is 0a 0 2 comma 2 square 4A 4 Square 6A 6 Square 8A 8 square but you can't directly give like this so you have to Define a variable name I mean a single valued variable then only it will save okay can we give another statement another if statement right you can use not not if statement another St after I like do increment I something Inc increment I um you don't need to increment I because this range itself is going from 0 to 9 right why you want increment suppose if it is 4 then okay list comprehension is uh there is some to say liation for this uh sorry sir for squaring sir you have multipied yeah sir same no no no sir below some below okay yes sir I for I for I cross I okay I made it Tuple with I comma I star star to yeah okay okay sir I mean this is a tuple okay this whole expression is resulting a single valued triple yes sir so that you can do but you can put I comma and I star two because these are two different different values and we have to make a single type of data so any doubts here sir can we take two variable for this single expression yeah it is possible um let me check m equal to I comma I comma J for I in range of three for J in range of five print M I'm also not sure I'm just checking yeah it is working so we can use this okay okay just uh experiment guys uh python is just English so just make random things and if it is working then learn okay this is working so next time I can use it like that so next Loops in list comprehension we can do list okay yeah next topic is that only so page equal to mty for in range of three for J in range of two you are appending the U uh what is this PS so we can do this in list comprehension first we have to Define one thing and again we have to do another loop and both will combine into this so what if I want both the loops to be separate uh sorry what if I want both the loops to be separate for I and J values for um I'm not getting what you're saying sir he wants to say use for Loop sir different Loops sir one Loop within one Loop okay then you have to use this only here you can't do that you have to do either you can do uh if condition if J is something then only add or else you have to do only one time got it but J When J is zero it is adding I two times when J is two it is adding one r two times I two times got it okay depending on the problem statement again how you want to use it hello sir yeah sir I have doubt in the same line uh sir how to identify which Loop is is Inner Loop and which one is outer loop this stat okay here oh here you are talking about yeah yeah incomprehension yeah yeah so whatever is the first it is first okay so for in range of three okay let me change this to five then we can see so the first I value check the I value I value is zero and the last I value is two okay whereas the J it is five so it is the last value of J is four so which is running first absolutely the zero right I mean the I value right because it is going till two okay python will okay I I don't think this is the correct explation python will go from left to right it will execute code from left to right so first it will do this one then only it will do this one uh yes sir sir then if there is a condition in which uh we have to write if statement between two Loops mhm is it possible in this one liner uh comprehension is to simplify the code but if you want to add some complex things then simplification can be possible sir then what are the limitations could you please explain the limitation of list comprehension limitation yeah right now we are just checking the P so we can instead of writing this multiple four line code we can in single line only we can Define thing but if you want to check if if three if I equal equal to 3 then only add this uh 3 not equal to 3 then continue I don't want to execute the rest of the code so okay three is not possible maybe one so if one only if I equal to 1 then only it was taking the J paays so I can Define the same here uh I can put if condition if I uh not equal to one uh maybe I have to put equal equal yeah if only I equal to one then only it is adding okay these are not the same but continue I'm not sure here you can put because uh these things you have to put like continue I'm not sure if the sir what what is going to happen sir if I equal equal to one yeah then only it will add this expression into this list okay sir uh so whatever condition you are giving if the condition becomes true then only this uh expression you are putting here will be added into the list that's how the list comprehension Works uh sir it means uh if statement will always come at the last of these yeah yeah so that's a syntax we have to remember okay so expression they want the expression you want to add in the list and the loop and after that the condition you want to give condition evaluates to true then only the expression will be added into your list okay and is there any else part we can write for if else okay no no no there should be L if only L if IAL equal to 3 because this is not a condition okay invalid syntax damn okay maybe we can putal 1 and I = = to three Jal sir can we use if condition first then Loop okay you can use this and operator to combine multiple if conditions oh sorry what is the question can we use if operator then for Loop no no that's a syntax if it syntax says that then it will give absolute to give error let check why not that we'll be learning so yeah expected else after if expression but there's not the syx okay so it will absolutely give error so better to know okay yes sir so if you want to have multiple if conditions then just put and uh L if also don't I don't think it will work you can put R uh I equal J equal to equal to Sir else will work sorry else will work else there is no point of else here let me check sir yeah there are the type of questions that will come in quiz one similar to the practice and graded assignments or is it similar to the grps I can't say that grps practice is just for the uh test your knowledge what you learn from the videos for exam point of view I would suest go through the previous term question papers you can find them in any groups you have joined there will be some groups right stent made groups there sir in op how many code we have to write there sir no no you you don't have to write codes the questions will be similar to as someone asked they will be similar but not exactly the difficulty okay to understand how the questions will be better to go through previous question papers only uh it will be somehow similar to practice and GRS for op where can be find sir for op just solving practice assignment uh practice questions will be enough graded assignment questions will be enough there will be mo also mock op have been released slots yeah whenever the exam will be near it will they will it has been released you can think about it so leave about that for the exam point of view just for the exam just go through the previous term question papers that's it and when it comes to list comprehension we can't use else because uh else is something we have to do when the any of the condition is not matching one thing also sir one thing sir op is going to similar like grpa sir or it is easy sir from grpa if you understand the how the how to code and if you were able to solve the grps then I'm sure you can do the op also so should we be able to test run in op yeah you can you can do any time any number of times you want in the before deadline okay let's go to another one transforming a list so you can update the values in a list um for foot in foot fruit. upend fruit. uper upper okay so while looping the through the list we are updating uh we are creating a new list and we are updating the current value uh values in the iterating list to a new list so with list comprehension you can update like this fruit. upper for fruit in fruits so instead of doing this uh this four line code you can simply do this in a single line two lines sorry two lines first we are defining a list after that we are creating a new list and we are looping through the list uh the previous list and we are updating some value through each iteration and we are inserting that to the uppercase frots but here we are just creating a new variable uppercase frots and we are using list comprehension to make the fruit string to uppercase and we are adding it into this got it no doubts okay combining multiple conditions okay here it goes par in range of 20 if I mod 2 equal to Z so multiple condition okay there is no Al if we we we have to directly use if so if any here and what principles are and or all sir both if is working sir uh sorry on what condition sir both if whether it is and or or sir so and will check if everything is true whereas or only one true is enough it's on this one it's following both the conditions yeah if any of the one becomes true then only we are adding the element or we can simply put r or both of them are fine sir yeah can we get the pyq for op uh for for op I don't think there will be C for now just focus on piz one later we can discuss on op white is giving different it should be yeah maybe and yeah okay let's put okay invalid s okay okay let's put and then it is not possible how can I okay okay okay sorry got it so it should be divisible by two and also divisible by three that's why so if you put R then two divisible and three divisible both are coming so if you put two if conditions it is checking if it is divisible by two and also it is divisible by three then only it is running so if you want to have a if uh uh so in list comprehension I don't think the flexibility of if L if else the only thing is if the condition is becoming true then only add it to the list that's the only primary thing we have to consider working on end sir it's working on and both if yeah it is working on so this one is resulting the numbers which are dis by three and two this is also resulting on the same but if you use r it is adding both two divisible and three divisible both but we don't want them so yeah we have to use if so the primary thing about the list comprehension is the whatever condition you're putting if it is evaluates to true then only we are adding that uh expression into this numbers that's the thing so there is no LF else you can just have multiple and or checking that's it any doubts here no okay okay python functions uh is functions introduced in uh week four yes sir okay yeah I think one to leure okay so function is a reusable block of code that performs a specific task instead of writing same code again and again multiple times we can just uh write a function somewhere and we can call it whenever we need so why we have to use functions because functions we can use the code as many times as we need instead of writing it modularity we can make a program into smaller chunks and it will be very easy to manage we just need to debug one piece of code and if the output is correct then we can attach one function to another function and we can make a big project with small functions which are uh without errors so R functions also very easy to read so by reading the function name itself sometimes we can understand okay what this function does so in order to define a function in in Python we have to use this def key word so we have to use the dev and we have to give the function name whatever name you want to give and curly uh this empty braces and inside that braces we have to give some parameters so these are the values which are which user when we while running we have to provide to that function and this is the block of code and what whenever we call the function this block of code will run whereas if condition if the condition becomes true then only condition then only this block of this will this block of code will run uh will run whereas function only if one if and only if we run the function that is by function name while doing this only we will run uh this block of code will be ran you got the difference between function and uh if condition yes sir yeah so this is the Syntax for function Define function name after that any arguments you want to provide that you can also give comma and you can pass multiple arguments and some conditions here you want to put then the final result you want to return When the user call anyone runs the function so name of the function input the function accepts specific what the function will output this is optional so basic function so Define we are creating a function G and it is printing hello welcome to python so when we try to call the function this is the syntax to call we just need to define the function name and this empty Braes brackets and it will run the function and this block of code will be executed and we are with hello welcome to python here there is no code but we are calling this function and this function is running that so just write once and we can use it as many times as you want that's the use of functions whereas if conditions you have to Define it again and again so just uh functions are very great so another function which is taking an argument called name and when we try to print a function without giving the argument here we are defined the name but we are not providing anything so if only if you put name here so then only it will print it so Kiran I try to run it now I'm passing the name Kiran so python took that name and in that function it is using the F string and it is inputting the name into this this string and it is printing the output hello k name whatever we give so we can give any name so we don't need to hard code that we just need to call the function and give the value and it will automatically update that string and it will print that so that's the flexibility of this what is f doing here sir yeah string formatting okay sir what's function sorry sir what the function of F sir okay explain this itself better you go through that recording in the YouTube okay okay what this F string does is you can include variables in a string that's it so if you define F and if you put the curly braces and whatever variable name you define here python will insert that variable name into this place so you don't need to hard code it it will automatically update whenever you want I mean the variable value will be appended into the string that's it so this is string formatting you are formatting a string with the variable names that's it got it so just go through that this recording you can see that recording right sir uh there is any at last please share link of this sir notebook notebook yeah yeah I will share at I will share at sir where where you will say sir in this GMA itself okay sir there is any rule for function name yeah you can give any name but avoid inbuilt functions like l so there is a len of so it will return the length of any itable right so if you define a function with the Len of and it will override that so better to not use inbuilt function names that's it so use some unique names my function and underscore at the end because it will Define you defined it or else add numbers so these are unique names just use unique names that's it there is no rule for why do we use parenthesis here yeah that's the syntax and here it will take inputs so f of x in mathematics you use f of x right what it means this is a function which will take X as input X is a variable same as here so it is a function which takes inputs f of x Comm y = to x + y something like that right same goes here and under the program we will use that under the program we will use it yeah while calling we have to use this so this is defining this is calling that's it okay okay so got it yeah sir uh if we have any doubts uh regarding the pyqs m so where can I ask about them yeah you can ask discour no like in the live session like in the sessions which sessions session agenda is like to explain some topic they will explain it and doubts regarding that only will be solved but if the session is not running out of time right now I only have 10 minutes so I have to explain this as soon as possible and have to solve someone else doubt if there is time then I will solve or else better to use discourse only Discord is great place where other people will try to solve your doubts okay and you also know how to professionally write things so better use it so I here it is a function add and it is taking a comma b as values and it is returning the sum of them so right now I'm making a variable called result and I'm calling the function add with passing three comma five as values and the output will be five8 5 + 3 8 so default parameters so if you don't want if the user not give any input then what to do so it will give error right right now if I try to give only three it will rise err because it is asking other varable so in order to avoid that so there is some default values so name equal to G in the function definition itself I'm putting name equal to guest so if I run the if I try to call the G name okay I don't know what was eror I didn't read it so I gave the default value name equal to guest so right now I'm calling the function without giving any value so it automatically took the default value but if I specifically putting some value name uh any string I'm passing through this name variable then it is printing that so that's the use of default values so if there is no input then use the default ones that's where we can use this default keyb values multiple parameters so a function can take multiple parameter separated by commas V to separate by commas and we have to give the same order then only it will take so X will be considered as four will be considered as X and five will be considered as Y in this whatever condition you are putting in this indentation indented Bo of code so keyword argument so we can pass while calling the function we can pass the values using keywords so here Order matters because X comma y the order is correct if you are passing directly values then you have to give the vales in the correct order if you're not sure about order then you have to give the variable name and then you have to equate it and then you have to give value so here the order doesn't matter so if I try to run this first so here I'm putting 25 comma name where 25 is age but uh the string is name but python it will take literally so this name is d25 is considered as name and the string value is considered as age and it's printing 25 is another years old but it is not correct so in that case we have to use positional uh keyword arguments so I'm defining age equal to 25 name equal to n and it will print correctly because we are directly giving the variable name so it will take accordingly it won't literally take the position so that's it so there is function scope if you define something globally like not in in inside indented block of code I mean not if conditions I'm just telling about this so x equal to 10 if I if you define a function then it will create another uh scope so if you change something there it won't reflect in the global scope that's the thing so xal to 10 in the function side I'm creating xal to 5 so this is a local variable so this is only for the functions in if conditions if you try to change xal 5 it will update out it will it will update globally so by running this example function uh it will create a new variable x equal to 5 and after that it will print five and when when you try to print X again it will still print 10 only because x equal to 10 in the global scope but in the local scope this is local scope in function it is local scope whatever you do here do here it will stay here only unless you return something so right now I'm return X and we are trying to update the x value by example x equal to example then X will be updated to five if we don't do it then it won't got it okay so that's about functions functions or Essentials in programming for organizing code make it reusable and improve readability understanding how to Define and call and work with parameters is a fundamental skill in Python so functions are very useful uh whatever modules you might use in the further they are all functions which are used which are all in another files when we are just importing and going to use them so practice more on this functions so types of function arguments can where can we find find this pyq uh just ask in WhatsApp groups there will be some student whatsa group sites someone will share I'm not sure about specific Source but you can find gr is grade yeah a.in yeah yeah ASG gr website there is some website you can just check that oh thank types of function arguments there are position arguments keyword arguments default arguments variable length arguments so position arguments if you give the position as it is it will take literally so if you put first put some value it will take the name as that only so these are positional but if you want if you don't want that then you have to give keyword arguments you have to provide the key uh variable variable name and also value then only it will take that so default arguments if you don't uh when they when there is no input then take a default value for that case you have to Define that in the function definition itself while defining the function itself and I'm not sure about these things covered in the week or not so okay anyone whoever completed the week four have you seen this star ORS no sir function no okay then don't learn it right now don't need to go through this and there are some built-in functions uh like Len Len is a built-in function user defined function whenever you Define something it is you defined function not buil-in functions where this Len is already in Python and Lambda functions what about Lambda function is it in week four no sir no no sir okay recursive functions also I mean in a function you can call the function itself again that's a recursive it will be in later weeks I guess higher order functions what about list map no map is not there okay map is there I guess map someone uh in instructor explained it yesterday yes I guess yeah so map is nothing but it will take it first it will take a function and after that it will ask for a list and it will map the elements of this list with this a function so it will pass that items in that list into this function and whatever will be resulted it will add that to this uh I mean it will create a new uh new list sir map function is in week five oh week five okay then yes sir okay then that's about uh maybe I have to move this to week five so that's about week one to week four link yeah so p on coll tutorials sh link so have shared in the chat so here you can find week one to week four collab first just go through them practice them and uh someone asked a question uh okay what is your question Someone pasted this in um hello Anand Kumar prajapati yeah yes sir yeah what is your exact doubt here here you are defining a uhhuh yes sir yes I'm not understanding the fod okay so let's go through that here you defining variable P equal to 1 so the variable p is having value one and after that you you defined a dictionary m equal to this m equal to length of M so what it is doing is how many uh rows are there in this m okay m is number of rows Row in Matrix M isn't it yes no yes sir so since there are three items in this list this Len of M will return return three so that's what it is and after that Nal to L of M of Z okay what do you think the value of n maybe one no why see L of M will return return how many items in list M whereas M of Z what is M of Z so the first element yeah first element that is this so what is len of M of Zer so L of this what is it is indirectly means this only that we have to understand so what it means number of columns in Matrix okay so this m of Z will return the first element in the Matrix and we are passing this list into this Len so it will return three again got it yes sir yeah after the you using for Loop and for I in range of M for J in range of n you are just multiplying so it is nothing but printing every um uh every element in the Matrix that's it uh print I comma J comma I comma J uh sorry M of I uh of J so the element at the I index of Matrix so at 0 0 there is one 0 comma 1 I mean zero throw and First Column there is two there is three zero zero row second column there is four First Column first row zero column two First Column H sorry so I is row maybe we can put like per Row in range of M for column in range of M got it sir got yeah thank you sir yeah row comma column in M of row Comm M of colum we are multiplying we updating the Val variable p with multiplying every element in this Matrix so this is nothing but multi multiplication of every element in this Matrix okay all else we can do is mean sir locating a space basically a of 1 one a of one two like this uh sorry so like uh 0 a of 1 one and second zero is a of one two and then one is a of 13 you mean to say that sir okay we are multiplying every element in the Matrix that's it this P star equal to I mean first the P value is one after that we are multiplying every element with that and see this is same this is nothing but multiplying every element in the Matrix that's it got it no sir yes sir okay what is your question sir what's that P is equal to M row column what is that doing sir so okay so do you know what this m of row yes sir it's a matrix yeah no it is not Matrix it is returning element in that Row in that column so this P star equal to what it is doing is p equal to P into M of row comma row and column so p is updating after multiplying the p with the I uh how to say the row and column value both are equivalent are you getting so it's a basically M of row column it's location of element in a matrix right yeah it will return so you should not think like that this is nothing but the value at that row and at that column that's it got it see at zero throw zero column the value is one that's what it means right and you multiplying that with p and updating that's it it's update P value we are multiplying every element in the Matrix okay while incrementing count you are doing count equal to count plus one right increment you want to increment so in the same way if you want to easily do that you have to do is Count plus equal to one don't you do that yes sir yes sir same yeah the same way if you want to M yeah P equal to P into five in in of doing this we can do p star equal five that's it now got it value update and here p is one yeah y one because if we try to multiply if you initialize the P value with zero the result will be zero for sure mhm so that's why now the result is zero so it should be one if you multiplying the initial value should be one okay sir okay this thing is discussed in week so this is nothing but multiplying okay updating and multiplying instead of doing this we are just putting a shortcut notation star equal to so it will multiply and update that's it are you getting yes it is okay any other doubts that's it guy week four okay and I think good to stop tomorrow we will uh not tomorrow Saturday we will uh solve previous term question papers as much as possible and that's it guys uh good night I'm stopping the recording yeah yes sir good day yeah have a great day