Learn Python for Data Science Full Course Free | Python for Data Science 2026 | Intellipaat 🚀
Skills:
Python for Data90%
Key Takeaways
This video provides a comprehensive introduction to Python programming for data science, covering topics such as Python basics, variables, data types, and data analysis using popular libraries like Pandas and NumPy. The course is designed for beginners and provides a hands-on approach to learning Python for data science.
Full Transcript
Hello everyone, welcome to this Python for data science full course by Intellipath where you're going to learn Python programming from scratch to carry out data science operations and gather the insights out of raw data. Python is the most preferred language in the field of data science and for a good reason. It has a clean syntax, an active community and a wide range of libraries that make working with data not just easier but incredibly efficient. Python ranks as the top skills required for jobs in data science, machine learning and AI. And with companies increasingly relying on data to drive decisions, Python isn't just a good to have anymore. It's a must-have. With this course, you will learn how to use Python for manipulating data sets, visualize insights, and build predictive models that actually make a difference. And that's exactly what this course is about. At Intellipath, we're on a mission to help you gain real world skills, and become industry ready. So, in this Python for data science full course, we're going to walk you through every single concept to get started in your data science journey. You'll begin with introduction to Python, memory allocation, Python fundamentals like variables, data types, loops, conditionals, functions, and slowly move into more advanced topics like memory management, file handling, working with modules, error handling, and object-oriented programming. But we won't stop there. You'll also get hands-on experience with essential Python libraries like NumPy and Pandas, the core tools every data scientist needs to work with data efficiently, cleanly, and visually. So without further ado, let's get started. Python is a programming language that was first [music] introduced in the late 1980s and has since become one of the most popular programming languages [music] in the world. In 2023, Python continues to be a powerful and versatile language [music] used by developers and businesses alike. So, what makes Python so special? One of the biggest advantages of [music] Python is its simplicity. The language has a straightforward syntax that makes it easy for beginners to pick up and start coding. At the [music] same time, Python is also a very powerful language with a wide range of libraries and [music] modules that allow for complex tasks to be completed with ease. Another key reason for Python's popularity is [music] the versatility. Python can be used for a wide range of applications from web development to data analysis [music] to artificial intelligence and machine learning. This versatility makes it a great choice for businesses as they can [music] use Python to automate a variety of task and processes. So why use Python in 2023? There are several reasons. Firstly, Python is constantly [music] evolving language with a growing community of developers and users. This means that there are always new tools, libraries, [music] and modules being developed that make it even more powerful. Secondly, Python has a large and growing number of job opportunities available in the market, making [music] it a great choice for anyone looking to enter the tech industry. And finally, how can you get started with Python in 2023? [music] The best way to learn Python is by doing it. So, start by downloading the language and working through some simple tutorials and exercises. [music] As you become more comfortable with the language, you can start working on more complex projects [music] and developing your own applications. In conclusion, Python in 2023 [music] continues to be popular, versatile, and powerful programming language that is well worth considering for anyone looking to get into the tech industry [music] or simply improve their coding skills. Whether you are a college student, a professional, or just [music] someone interested in coding, Python has something to offer to you. So why not give it a try today and see what you can create. Just a quick info guys, Intellipath offers a data science course in collaboration with iHub, IIT, Riy which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So visit the course page link given below in the description and take the first step towards career growth with the data science course. >> We are going to get into a little more you know more into the basics of Python right. So I would start with a bit of you know like you know so why do we need Python in what places you can use Python right? uh then second thing would be like more on starting with the python variable to get you an understanding of that how does the variable assignment work then I'll get into multiple variable assignment names no global variable then we'll come to the data types right so that will be going to the flow for the day okay so I think I if I recall correctly I had started with uh a quick discussion on that what is Python and how it is different from other languages like C or you know you know Java and I think I talked about uh few pointers on which I was trying to explain that you know why Python is better and why Python is not good right so there were there there are pros and cons right pros and cons so Python has its own advantages but with also some disadvantages okay so any question from that angle compiler versus compiler versus interpreter I think I did not make any note here so let me quickly complete that part I think we were just discussing it see so let's say uh we compare you know compiler versus interpreter generally if someone starts with the history of python okay so you have to keep it you know very simple very uh very much to the point you know you don't need to uh get into too much of the detail. So compiler based language it translates and that will be a quick revision as well. It translates the entire source code into what language guys come on. I I had discussed that right into the machine level language and in a single run and that's what compilation means right you run it and that will be one single run and then it will convert everything into a machine level uh language in a single run and then you will understand you know what went wrong what went correct on contrary uh interpreter it translates the entire source code. Even if you write the whole Python code, it also does that in a translation but line by line. Second point could be on the uh time consuming, right? So it consumes less time and this is on the computation side not on the debugging side. So please be uh clear here. It consumes less time and hence it is faster than Python or any interpreter based language and you have to read this. I'll make a comment here. You have to read this with respect to computation not like debugging. Debugging definitely takes a lot of time. Python debugging is simple. I'll make a point there as well. It it takes more time consumes I'll just write one line consumes much more time than the compiler based language. I think this is not required. Okay, then I would say it is memory efficient and that's why when I teach you numpy you'll understand that all the compiler based language they do a good job at you know allocating the memory and when to you know uh flush the memory to take the garbage out. On contrary Python is not that memory efficient. So you can see all these pointers are it seems to be like it is against the Python but not Python has some really beautiful feature which compiler this language is not having like for example uh debugging takes a lot of time here takes more time here I can say debugging is takes less time and you remember why debugging takes less time because it runs line by line if something comes comes as an error you will know in the next line. Remember that's the reason and here debugging takes more time because every time you have to complete the comp uh compilation complete compilation happens and then you can debug. Okay. Now let me uh give you some ideas about debugging. So let's say suppose what do you mean by debugging? You have written a code and code goes into error means suppose I'm trying to read a file and do a summary but somehow that summary is not working out some error is there can be a value error it can be a key error there are different types of error and for now don't go into that but debugging means that you are trying to understand the bugs in your code so what what do you mean by bugs means the issues in your code and you're trying to take it out right that's the whole process is known and debug. So take the bugs and remove it. Now why debugging takes more time guys? Because complete comp compilation happens and for that you need time right and then you can you know definitely uh debug. But in Python you run line by line. So you don't need to wait till the whole source code is translated compilation is done because it is an interpreter based language. You can just run that line and still you can understand what is the error and everything. Right? So that's where the advantage is. Memory wise, I think uh Python is not that great because it uses different memory allocation. And guys, again that is out of the scope for the whole data science because you don't need to go into that just a comparative analysis so that you have an idea. These are some key bullet points. Don't double click on the bullet points because to get into the whole memory efficient analysis, you have to understand the memory management in compiler based language versus interpreterbased language. And that's not really we need to do that. Okay. Uh in data science you don't really need to put much uh focus on this. But just to give an idea like array array does the uh you know you know allocations of the you know data elements in contious memory allocation. So it means like you know it does a very smart allocation of the memory in simple English. Python does a more so array when I say not the Python array array is coming from C and C is a compiler based language but if you look at list or data frames they're not very efficient in memory uh the moment you load a big data right like I'll give an example like 20 GB file or 5GB file excel file which is a CSV format it loads into directly into the memory and the moment your RAM is low so when you when I say RAM RAM is your computer memory right let's say you have a RAM RAM of 16 GB but you're trying to load a 15 GB or 14 GB data your code will not run it will start showing out of memory error but uh chances are very high that if you are managing this in C still you will be able to turn it around on that okay now comes the consumes less time and more time in terms of computation so again since it's efficient in terms of memory and it uses array different data types data structure to be honest so C does some of the computations what do you mean computing Suppose I want to multiply quantity into price. Let me take an example. You have a data. See this table. You have a data in which you are selling items just like you know item A B C D. And this is going for like you know 5 million records quite a quite a few right and you want to multiply quantity with price to understand your revenue revenue. So obviously you you say two two units I have bought at 100 rupees one unit at 50 rupees and you want to do a multiplication a simple computation right I'll show you when I'll teach you numpy that computation done this can be done in list also right this can be done in list data type also versus array here I'll prove with a real example that array is somewhere 10 to 15 times faster make a note of it guys so when I say array is faster means this array is coming from which language C list is coming from which language my dear Python so you understand the second point is all about computation is it if C is faster than Python why we are not using C because C does not have very good library it's also like that's where I should write one line that data science libraries are the best in Python that's the reason that people still want to use Python you don't have uh good libraries in C for doing Python. Not all libraries are made of C. Only NumPy is based on on C. Pandas is not on C. Okay. So data science libraries are the best in Python. So uh if you take C and you try to get into the libraries see that's why you have to do comparative analysis. You have to sit and do it. So few things you have to take on the merit of statement. Okay. And you can uh sager uh I think you can stop writing in caps because caps means you're writing you're not writing or shouting. So if you're not aware just let me make you aware of this. If you're writing in chat in caps means you're shouting you're not asking a question. So uh uh if you're not shouting please write in uh you know uh the normal because caps actually you know stands out. Okay. So now coming back to how elaborate uh uh we can definitely we statement on the merit that data science library are yeah data science libraries are are the best in python. So let me give you the name I would say I have not heard a lot of data science libraries from seed. I need to do some bit of research because I have never heard that they are doing anything on that. You have cited, you have scypy, you have numpy, right? You have pandas for data manipulation. You also have uh mapplot lift which we are talking about, right? All these are amazing and all these we are going to study in this course. I think I'm going to teach definitely these ones which I was trying to talk about but sooner or later you will also be introduced to these topics. But if you look at the C you will not see anything coming as a data science. You don't have a lot of uh functions libraries which are famous which have good community support which are getting all the recent developments happening and that's where uh data science is the back for them. Data science is not the priority. Python data science is everything. Okay. So community support is also important. So now if I give you an idea that you have LLM models you must have heard about chat GPT. So chat GPT works on LLM model right. So large language models are the ones which are making a lot of waves in current time. But if you see that nobody's talking about that in uh you know C because it's all done in Python but if you observe that and can tell me that okay can we do in C I'm not saying no. It's just that's not convenient to do in C because you don't have a lot of community support a lot of materials available for you to do research and do some developments right so Python is contributed as the top language as you can see on this index as well right so there you have more support and lot of new things are being covered every week new things are coming okay make sense so that's the reason that why I'm saying uh that why your data science if you're looking at data data science you should look at you should look at Python I think that has been taken care of I think uh we have to definitely then the next question will that can we [clears throat] elaborate on that so see both are data structure just to add to what Pa has mentioned praa so both are data structures and uh you know but they have different characteristics to be honest so if I talk about memory allocation so arrays are stored in contiguous memory allocations right so basically The meaning of contiguous is that you know they will be stored or placed in adjacent cells right and that's where arrays are always indexed right they have the indexing 0 1 2 3 and that makes them fast and efficient but uh as compared to that link list is is consisting of nodes and you know and they're not stored in the contiguous memory location so they're not like you know if I can go back to my one note and so when I say indexing thing you know if you have observed list is also an index based data structure so 0 1 2 if I write or if I put my name here if I put my name aash here so here we are storing this into side by side can you see that's what I mean by when I say indexing adjacent cells it's very easy to you know retrieve this data and you know push it and retrieve but compared to this link list they are storing in in non-contiguous so they're not you know being stored in the adjacent cells and that's it is a bit slow. So link list uh data structure is a slower data structure as compared to array and that's a well-known fact. Let's come back to the the next topic. I think it will be variable, right? So what is a Python variable? Yeah, what is variable in Python? Let's see what you have learned in other languages or I know also that you guys have done Python. So what is variable in Python? Container to store values, container to hold information. So the moment I write x = 10, how do you interpret it guys? When I say x= 10, how do you interpret? It means that in the memory you are putting 10. So first tell me definitely you are going to say that here 10 is assigned to x. Are you going to say that? Perfect. Okay. So definitely 10 is assigned to x and because of this operator this there's an operator involved guys and we are going to double click on this. This is known as what operator? Assignment operator. Okay. And then you also see that 10 is a what? In Python what or in the Python lingo it is known as object. X is not your object. Always remember that 10 is your object. And you are giving and this 10 is going to get stored in a memory. Right? And that memory will have some ID. So it is going to be stored in a memory with ID. And let's say I'll show you in the hands as well with ID and ID is identity or think like your identity you have a Aadhaar card right or you have a PAN card similarly this 10 also has some information in terms of ID that's going to be unique and generally it is something like this like you know 16 digit u if I recall corrective I have not written 16 but yeah let's not uh get into that with that seriousness but there's some ID which is unique to this object Now then what is X here? So X is known as object reference. So you're tagging this X you're assigning uh a value 10 to the X or you rather say that you are referencing this variable uh with uh sorry you are referencing this object with a reference variable name object reference X. So when you are saying X you are referring to object 10 with assignment of X or maybe let me keep it simple you are referring to this object 10 with a reference which is your calling X which is your variable okay it's more like a tagging okay and what is the interpretation of tagging tagging means like assigning a value 10 assigning a value 10 to the variable X when you'll get into hands-on and if you write what is ID of X and this ID is known as identity. The full form is identity. You can also get a machine level you know hex code. So you have to do hex of id and that will give you a hexa decimal or hex code we also say for that particular ID. Okay. So suppose you are saying x = 10 y = Now I'll move on to the another example. This is example one. I'll write ex1. If I move to another example and I write y = a. So that's my initial guys. Take ABC. Now tell me what is difference in these two. Please be interactive guys. What is the difference between these two examples? The person who quickly observed that you are talking to different data type. Right? So if I can just I'll be using a lot of arrows guys. So I I really like this mapping thing. The only thing you'll see different here is that I know you will say sir this is X, this is Y, this is another variable. That's fine. But the key difference is what data type? What is this? This is your integer data type and this is your string data type. So when we'll get into different data types, I will be showing you that that different data types have different types of properties. They characterize differently, right? Even the same function will be used differently on the different data types. So for example, if somebody says that okay, what is length of this? What is length of X? And if I say what is length of y and you put right and you try to understand that what's going to happen uh in different functions sorry uh for the same function different variable you will be amazed to see that if x is a list kind of thing it's a list is also a data type by the way guys this a sequential data type and I'm putting this here like you know 10 25 6 and if I put a string here and I'll say that okay 10 is for let's say KPC string 20 is for let's say KPME right or something like that. So you will understand that the same function length has a different answer for list for a for a list and for a character data type. So for example character means I mean I meant string data type. So if I say what is the length of this you might get number of count of characters here but here length of list will tell you number of data elements in the list. So there are two different things happening here but all these you will see uh at the right place and that's also known as in oops language polymorphism. So these are some key word I'm giving you to uh you know excite or maybe you know make it a bit little interesting but idea here is that just note it down and wait for me to explore it. Okay. So what is polymorphism? If you start thinking now you will get panicked you will get confused but uh I'll show you when I'll talk about length length I'll talk about when I'll teach you list I'll teach when I will completing all the different data types. So there are going to be sequences but polymorphism just for your uh quick understanding poly means many uh poly means many and morphism means form. So same functions are showing different characteristics or different form is known as polymorphism in Python. Now guys let me quickly put a definition on variable. So let me write uh so it's a very simple definition where we are saying that a python varable is you know is a temporary storage location. Why temporary? Because you you don't go and create a file unless until you save it. So the moment you write x equal to 10 it it picks the RAM which is the the memory location and and tries to put some value there with the address. But if you just delete it or you just close your Jupyter notebook that will be lost. Okay, makes sense. Unless until you store it uh in your permanent memory location after writing step. So generally it's a temporary storage location that will store a particular value for a particular variable. Simple. Now I'll ask another question guys. You know there is a concept of declaring a variable versus initializing a variable. Declaring a variable versus initializing a variable. Declare means make it available. Okay. So let's understand what is declaration. Declaration nothing. You just say that I will be allocating a memory for the variable. Okay. And that variable can be anything. It can be a numeric data type. It can be a list. So suppose somebody says that my list I'm creating a variable called my list my list and I just put a double square braces. When I'll teach you list guys for now just you can keep it for uh keep it just as an information. This is known as empty list. Do you see any value assigned to this? No. Right? It's all empty. There's nothing within this. So it means that you just said it to your Python that Python can you give it a memory for this particular list I'll make sure that when I'm running a for loop I'll fill it. So when you're running a for loop you're using this uh empty list and try to fill the result of your whole analysis or whole computation into this list. So when you are trying to run the for loop and trying to fill the values that means initializing make sense. So allocating a memory for a variable or you just declare a variable means what you're just saying variable my list and you give a memory date there's nothing in there it's empty what will be the next step my dear next step would be once you are done you'll be saying assigning and I think that part everybody got right assigning value to the variable is known as initialization sorry I missed that arrow should come from here okay so for example now in this I list if you see some numbers are coming like 10 20 30 40 50 that is your initialization but Python is a very bad language in this way because they are very fast and smart when you are writing x= to 10 let me take a step back and show you when you write x= to 10 actually you have done two steps at once you have also declare you have done the declaration my dear and also done the initialization isn't it guys come on that's where python is so no bakbas right straightforward to the business straight to the point suppose you have to do the same thing in C and those who know how does C work you will you will not write like this you have to at least write three or four lines of code there isn't it guys if somebody who is an expert in C can you just ping the code for C the same thing I want to store a value you know x= to 10 in how will you do it but the the right way to you know can you know can if you can write in C declaring creating a variable initializing it you will not be writing just you have to write a code which should run also right so ideally you have to do a lot of things so first I think you guys are right if you write int x = 10 right or you you know so definitely here this part you are trying to declare a variable x of integer data type and then you are assigning it but here say you don't need to write integer you don't need to write anything you don't write hash include everything you can just write one line of code right and it should do. Okay, but in C ideally you will be you know writing two three lines of code. Okay, but let's not get into it. Yes, very good. This is what I I was talking about. Okay, so what may has written and if you try running it. So I'm copying and pasting guys but let's not del too much into it. I'll just make it uh int x so that it is going with my exam. So you have to you know use some some callable functions like include main and then you will get into this. Okay. So that's where the difference is. Okay. Now guys I will also teach when I'll do when we will be doing machine learning right. So you will be doing a lot of multiple variable assignment. Even in array I'll show you some function where I'll be doing multiple variable assignment. So Python is so kind in terms of writing and making our life easy. So there were question right why we why do I need to use Python? Python is really very easy to use. Okay, [clears throat] any anyone can learn Python and that's why I'm saying class fourth grade, second grade, third grade guys are learning Python because it's so intuitive that you can also write multiple variables and assign it in one line of code. So what is the meaning of it? When I say multiple variable assignment, we can declare multiple variables in a single line mean in a single line of code in Python. So I'll give you an example. If I say x comma y comma z and I give you you know same 10 comma a c and you can also put a float 20.3 and if you do print of xy z right you will see everything is coming. Okay. Now can you see that X is getting assigned to sorry 10 is getting assigned to X in my example Y and this float this float guy is getting assigned to whom Z. So you have to be very careful when you will do a machine learning uh kind of you know so when you do machine learning right you will be doing training and testing. So now don't again ask what is training and testing uh we will be learning that but just to give a quick idea that when you try to fit a model so you need a training data set and to predict it you will be doing testing data set so training and testing is going to be your bread and butter throughout your life okay uh if you are being a data scientist so don't worry that oh what is this I am not aware of you are not aware you have not been taught so just don't get uh panicky about it but let me show you this I'm taking it from the uh one of my simple examples where you are trying to do the training testing guys can you see that are here what I'm showing to what what I'm trying to show here can you see it's a clearcut example of multi-assignment multiple variable can you see that guys training and testing for X training and testing for Y guys can you see that don't worry on the right hand side what's getting getting there definitely this function just try to understand be smart this function is going to generate four set of data frames or arrays later you will realize any data type but four why four because this is four 1 2 3 four so what we are learning here is getting used here okay that was the reason to show you this so as a practice I don't do a lot of multi-assignment okay to be honest because it can get confusing but if you try you're trying to do that you have to be very careful I'll tell you why because if you just change the position. If you write x train and if you write y train, it's wrong. You understand? Okay. Okay. Let me give a simple example. If I write x = 10 and y = APC, what is the interpretation here? X= 10, Y= APC, you are running two lines of code to get it done. X will have 10, Y will have APC. Now, what I'm saying that just to save some time and energy, you can write the two lines into one line. That's also I have defined right if you focus on this these two words we can declare multiple variables in single line that's exactly being done now come to our example this function train test_split tries to create four set of data frames you can assign all four into one line you don't have any other option want to do that then you have to write your own function so this function generates four set of data frame that's what you are seeing x train x test y train y test simple okay this This is a simple example, a very real example of multiple variable assignment. Now, naming convention is also very important, right? Because you cannot name variable the way you want. You have to follow some rules. Okay? So, for that, let me give you a list of naming convention so that you don't miss on this. Yeah. So if you have to name a variable you have to focus on few things like variable name can you know case sensitive so you cannot take it lightly. So to give an example if you're writing my underscore list and you're writing my underscore list. Do you think they are different guys? Exactly. They're different. Why? Because here m is small letter and here m is capital. So that's the reason that if you have declared a variable this one and trying to search for this one you will not be able to find it. you will see an error in the code. Okay. So, variables in Python are case sensitive. A variable name cannot be start with a number. You cannot say suppose I like Dhoni, right? So, I'll not be saying okay 007 or 7 or my variable name is 7 mahi, right? It it it will throw an error. It's not a proper way of giving a variable name. Okay. Although you can do that you can write mahi_7 or you can also write mahi 7. That's fine. These are accepted. A variable name can consist of alpha numeric characters which I have already shown here. Right? This is what I'm talking right. Special character cannot also be a right like you cannot like add the rate mine. Right? This variable name is not going to work right. You cannot say hash money. You understand? So all these are not accepted. So you have to be careful. There are certain keywords in Python. They are known as you know more are more like reserved keywords. So you cannot use it for variable name as well. So let me write one line about it. So there are certain keywords and these keywords are guys you know more like your standard keywords which you use for a lot of things like for for example print. Print is one of the famous keyword for getting your output printed right but you cannot use this print as a variable name. Okay. So for example if I say print focus guys let me complete then I'll come to your question print delete for loop you have for define defaf for the function you have while so there are there are few keywords pass continue don't use this as your variable names it will be throwing an error okay clear okay there are some good uh uh abra that's right hyphen is not accepted as far as I default cap Capital def I think you can use but why to want to use that let's not use something which is confusing with the reserve keywords right so why to go closer you have so cool variable names okay you can also not use like uh my at the rate 007 that's not also acceptable it will throw error at the rate not only in the beginning also in the middle cannot be accepted underscore is accepted that's correct yes so if I write E_00007 100%. Ideally I use a lot of underscore if you see I created my list right what I use there see underscore underscore is a good so generally I'll tell you what to use rather than telling what not to use I said I was say I should share you should always use this right my list you can write my underscore list you can write people also write my list like capital L I don't like it personally speaking because you have to be very very careful that you don't miss on capital Right. Okay. Make sense or not? All these special characters you cannot use a sign. Okay. Symbols if you're asking all these special character cannot be used. I think underscore can be used. Uh I think dot cannot be used either. I think yeah that's correct. So special character means you know uh t you know at the rate add. So don't worry you will be figuring out on your own. So there's nothing there. Don't try to remember it. You know that's what I'm trying to say. If you don't if you try to remember it then you get you'll get confused. So don't do that. Over a period of time it it will be easy for you to uh work on it. So don't worry about oh I need to remember it uh how to you know what are the ones I need to uh what are the ones I need to use. If you try to remember it you'll be confused. Okay. So remember I gave you y equal to a c. If I count length of Y, it will be how many guys? Come on, tell me three. Suppose I give a space a P and then give a space here. It's not underscore, it's a space. Just see. And if you count just one space, you have to click the that long key only once it will be four, right? You'll see all those and then you'll get into hands on you also able to make it out. Okay, cool. Now I think so we are done with this. Let me just talk about quickly global variable and then we were able to complete the variable. So global variable anybody what is a global variable in Python. So let me let me put it I think you guys are right. So global variables are those which can be used outside the scope of a class or function. So class when I say it's more from the oops side function when I say right suppose an example you can see on the right hand side. So now we'll not delve too much into it guys because I have not talked about what is a function how do you define a function right. So let's not get too much into it but just you guys are right a variable which which is defined outside a function and can be used inside right or can be used in across multiple functions like prime minister is a global variable prime minister is a global variable but a cm is a local variable understand what I'm saying hello it's a very cool example I should get confident so prime minister is a global variable right it's for all the states across the states I know there are some concurrent list, some state list, some central list, right? Uh but uh so when I say this concurrent list and all this is like you know job scope what you know what is within the central government scope what is within the state one scope is all uh you know the policies and all I'm talking about but let's not get into that uh I'm talking about that they have their own roles and responsibilities. So PM has global roles and responsibilities across the all states of India but let's not get it political. Some of the guys will start saying no no PM is not paying attention to the state. Let's not get into that. Okay. This is the only uh concern when I take political example but it's a good example. Okay. So when the right time will come I'll show you a global example as well. So why I'm pushing all those things on the on the on the future because I have to do a hands-on to show you. But just to give a quick example of it, uh this is a good example. But let me give you my own example here as well for the global variable you're able to read. Is it readable? Now this is a variable which I have defined [clears throat] x = 25 which I have defined here is your global variable. Okay. Now let's say I define a function. Let's say I define a function called add which will do the addition. So these are some function syntax. You have to write def. Okay. And then you write add. And then come within the function you can write a another variable called y = 75. The only thing which you are going to learn is that this is a glo variable. So this this guy is a local variable. Why it is local variable? because it is defined within the function. The perview is the function. Now if you use Z equal to X + Y, do you think it will work? And if I say print addition of X and Y is it will work right and I say zed. So you'll see that zed will come out to be 100. Ideally it will not come like this. The output will like this. Let me show you the exact output. So what you will see in the print console. So addition of x and y uh it will come. Okay, clear that's a global variable and local variable. Understand? So def will define. Yeah. So within the function see read the definition. Global variables are those that can be used outside the scope of a class of function. Now if you try to call this variable y in some other function, it will not be uh called off, right? You will not be able to use that. But if you're trying to you know call the variable x in some other function right it will still be called. So this is like a global variable. This is like a local variable. So local variable cannot be called outside this function. And these things we will understand when we get into hands on. So few few things guys again I'm reiterating you have to take uh at the merit of what uh trainer or ta is telling and then we can validate it later. Okay. You might have some doubt. No, no, no. I don't think it's right or wrong. Right? Let's not get into right away because when we'll go into the right set of things, then only it makes sense because before I teach you function, I cannot take an example just to show you that it will be not correct. Data types. Shall we get started with data types? I think data type is one of the I think it's one of the very important topic for the basic Python. If you don't understand the data type, you not understand the different data type methods. Let's hear from you. What are the different data types in Python? You are aware of type of data variable can store int, float, string, int, character, integers. >> Python in in Python things are a bit different. Okay, to be honest, so let me show you. There are two types of data to be honest. Uh number one is numeric data type. Number two is sequential data type. Right? What you are saying you know all the time float string integer right all these are not the same data type integer float and complex they are your they are your numeric data type when you say string or when you say let's say list or when you say dictionary that will become your sequential data type set is again the same okay so let me give you the first what is data type or definition and that's very important because without the data type you'll be struggling to be honest right and uh data type is one of the key things when you try to do Python so please don't take it lightly so for example uh if you are looking at a 2 + 3 you are actually looking at data type right suppose if I say 2 + 3 you know it will be five everybody knows that but if I write 2 + 3 = 5 the first thing you should focus that both are inteious And then you're doing an assignment operator here which is addition. Uh this addition operator it's arithmetic operator right? And then you have this assignment operator. So addition operator assignment operator makes you the whole process here. So in this one line you are actually doing a lot of concepts to be honest. Right? If I write 2 + 3 = 5 you are looking at data type guys. You're looking at operators. Can you see that? So all the yellows are what your data type as a matter of fact this is all int data type right but this is your addition operator which is coming from arithmetic bucket and this is what assignment operator right in one simple calculation you have this but if you're not sure about data type and when you write you know list one plus list two and list one is also having two here and list two is having three here. What do you expect? Do you expect it will be list another list and the output will be five? What do you think guys? Bit of exposure to Python. Do you think it will be showing five here? It will do the sum of this. Very good kit. Proud of you. No. No, it is not correct. It will do a concretation. It will do a concat. Right? Why? Because it will just go and combine these two. Right? Right. it will give you this 2a 3 2a 3 it will just combine these two guys concatenation list right that's I'm talking about so again another topic will be like okay uh concatenation means what so obviously you're going to combining two or more list into a single list that becomes a concatenation operator is same can you see that it's the same operator it's the same operator but the behavior is different huge huge difference in the behavior why because you are not operating on the same data type. What is this data type my dear? This is what data type? This is list data type. It's a sequential data type. So here the same plus is termed as concatenation. Here the same plus was from the addition. Are you feeling it guys? This is how I introduce data type. Right? So it's very important that you understand what data type you're dealing with. Else you will be completely or grossly mistaken. Right? and your answers will not be in line with what you're expecting. It will all erroneous. Here you are trying to do an element by addition answer will be something. So now we can get into that textbook definition that it is classification or categorization of data element is you know referred to as data type. Uh it's a it represents the kind of value that uh also helps you with what operations can be performed. Right? That's exactly I have done here. Okay. So we have taken care of that. Now let me show you. Now numeric data type, sequential data type and boolean data types. Right? So numeric data type let's talk about. Okay. So I we have definitely put put together some really nice slides have been put here. Numeric data type. Let's start one by one. Numeric data type. So numeric data type in Python right uh represents or it will be showing different types of uh numeric data having values. So for example if if I talk about inteious all these guys like 10 20 30 the all the numbers right are your inteious without any decimal suppose I write float it is 10.5 uh it can be 10.23 23. It can be even you know like this which is your 3.33 33 33 33 is also a float. Okay, don't get into rational irrational and all those things here. Okay, so this is also float. Even if you write 2.0 what is this 2.0 0 is what positive negative by default you have to take complex you know that 2 + 5 J - 2 - 3 J I'm also writing some minus number so that you don't get confused - 20 - 100 negative numbers also there now J is something you will be using not iota so iota I generally people don't use in Python it will be J okay so these are your complex number I think everybody knows that this is your real part of the complex number this is your imagin ary part right and J is your root under minus one remember so I have taught mathematics for ITJ so you can the most complicated ones so J is equal to root under minus one so complex is so if you do look at the numbers theory right or number system complex number is the highest then comes your rational number then comes your inteious right both positive negative then comes your whole number right integer I So that's how the hierarchy looks like right complex number is on the top of it. Even you can write a real number like 2 + j0 right nobody stops you. So real number can be represented as the complex number but not the vice versa right not vice versa. Now let's take what do we have in integer. So if I talk about integer integer refers to the int class. Okay let's you know now double click on each one of it. How can we calculate 5 J? No. So what is happening? Then you're asking a maths question. So when you write 5 J basically it was written like five root under minus one. Understand that? Okay. So it's not like that you are going to calculate it. You are actually representing it. It's a bit of representation. No, you have to take it and and I think there's a question coming from Antony that where we use complex number in Python in complex calculation. Suppose you're doing a signal proc uh signal processing or you know fyear analysis. So some mathematical kind of or scientific research only will use complex algebra but suppose you are getting some negative under root right root within the root you're getting negative means it's complex okay just keep that in mind but I don't think that you'll be using it in our course somewhere okay but if you really want to understand where you can use so if you are from electronic background or electrical background you know signal processing so signal processing uh uh is more like a an area where you are trying to understand different types of signals and signals can have you know imaginary components as well. So I have done B techch electronics and those who are aware of it uh signal processing. So you have that fiery analysis there also you'll get complex number or if you have seen right so I don't that's why I don't want to go into that because then it will be like really overwhelming for you guys let's not go there that's not required for us but I need to tell you what is a complex data now come back to integer data type guys so integer is of int class so whenever you will see any integer suppose I write x= to int and to x= 10 and then if I print type of so now I'm introducing one more keyword type so type gives you the class of variable X and what is the output it should show guys it will be showing you a int okay int class make sense or not contains positive or negative integers right that's fine perfect covers whole number obviously we cover whole number because you already have whole number is what starting from zero natural number starting from one so obviously covers numbers, whole numbers, natural numbers, everything. And sometimes people ask me that how long an integer should be. There's no limit. Python doesn't give any explicit limit on anything just like uh unlike C or Java, right? I think C gives you some limit on 256 or something. But Python does not give any limit. You can give as long as possible. But uh I am sure that there will be certain limitation. But they don't explicitly mention that. Obviously every you know everything is there with some limit but they don't mention about it that's what I was trying to say okay now moving on to float focus on the right uh right things here float float again it has a class called float so you will be seeing the class written as float uh all the real numbers which can be represented with floating there not not much to talk about it you have to just pay attention that there will be a decimal point for that Right now I'll quickly wrap it up. You know complex which is we are going to not use at all to be honest. Right. Complex is complex class written as complex keyword. You have a real part. You have a part and can you see that you have a J here. Right? And J has to be after the number. Okay. That's another thing guys. Sorry. Just recall. You cannot write 2 + J4. It will give an error. Right? You have to write 2 + 4 J this is wrong as per the representation right there's a question that what is the value of 2 + 4 C you are saying that what is x = 2 will do nothing so 2 + 4 j is a representation in complex plane or you know let me show you so when you go into a complex plane on the x-axis you write real part on the yaxis you write imaginary part right so when you say 2 + 4 J it just mean that 1 2 3 4 1 2 3 4 2 4 so somewhere here your number will be located are you getting so this is what we also call argan plane right so that's what it means it doesn't give you any value there itself you ask like 2 3 what is the value are doing some math operation then you'll ask value now 2 + 4 J is just a number in the complex plane are we clear Just a quick info guys, Intellipath offers a data science course in collaboration with iHub, IIT, Riy which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So visit the course page link given below in the description and take the first step towards career growth with the data science course. >> Can start with sequential data type one of the most important data types. Can you see my screen? Okay. So sequence data type. Why do we call sequence data type sequence? Because you are able to you know put your the data in a sequential manner. Basically you start uh with let's say some numbering some positioning to it. not necessarily it has to be you know uh it has to be ordered that is my one call out here so generally this so I saying that data types are the ones which allow you to store and manipulate you know general loosely speaking ordered collection of item elements or values okay that's what we call sequence data type but in Python uh there is one exceptions to it and the exception is what set data Right? So if you look at the sets right they are ordered or they're unordered. You have quite a few of sequence data type right. Set is an unordered collection of data types. So that's where although sequence name suggests or it means right conceptually that it is an ordered collection of data elements or items or entities. But on contrary to the definition it has slight a bit of uh exception and I think that's only uh that's only one set is unordered list is ordered dictionary is ordered uh so we'll talk about it in detail keep making some points okay focus is going to be on list but we'll start with you know all the different types of sequence data and let me show you so someone can ask you this question. What are the sequence data types? Right? You should be able to answer this. Sequence is ordered collection of similar or different data types. Although set is sets are unordered. So I I'm myself telling you right that although we are putting set within the sequence data but it has an exception to the definition. Okay. So what are they? String, pupil, uh dictionary, list and set. The most critical data type is here list. Then we will most seeing is the dictionary. Then you'll be seeing string maybe I'll put in terms of stars and then comes your pupil and set. So as you can see this is the rating that list is going to be your bread and butter. Make sense guys? Any other data type that you think I have listed? Yes. So boolean will be coming. That's that that's the reason I was trying to ask array boolean are all different under the different buckets they come. So array will be coming as a data structure itself and that will come in numpy. Boolean will come as the third data types. Remember so when I gave you this list there are three types of data in Python right? One is numeric one is sequence and the third is boolean data types. Array is on the top of it. Make sense? Everybody comfortable? Data frame is another data structure that will be coming on top of it. But fundamental data types if you see these are the ones in sequence. Perfect. So now let's talk about list. What is a list? Anybody? Let's start with list. Question is that what is a list? Antony kind of an array where we can store different type. Yeah, 100% correct. So you are indicating hetrogenous behavior of list right isn't it collection of data stores a collection of data ordered very good Katherine it's ordered anybody on the mutability is it mutable guys nobody's talking about mutability of data first of all what is mutability of data what do you mean by mutable immutable can be modified ability to modify the values right generally when you define list right Yes, you should always say that list definitely is you know list is a collection which is ordered and changeable right so let me give you some pointers here so what is a list I'm putting the screenshot guys list are just like arrays declared in other languages so they're talking about arrays like in C which is an ordered collection of data okay so let me add to this because this is little limited here. So if I have to define list, I'll define list as a list is a collection of data. Follow guys. A list is a collection of data which is ordered and changeable. Which is ordered and changeable. What do I what do I mean when I say changeable? Changeable means mutable. Which is changeable? write and continue with a comma and write allows duplicate elements. Do you know this list does allowate elements unlike sets sets they don't allow duplicates element and the collection of data you can underline and write the data can be heterogeneous I'm coming and covering don't worry Dudra so what do you mean by heterogeneous that a list can contain all the different data types integer float complex right what string are we clear that's correct list can also contain list so nested list we call them now guys when we talk about list indexing okay index so if you recall very good praa and samina indexing is there right so when we say in in case of right list which is an ordered right it means so when I say ordered what is the interpretation of it guys let me write here so when you say ordered what is the meaning of it. So order refers to what? Arrangement of arrangement of elements within the sequence. Right? And how do we do that? Arrangement of let me write here elements within sequence via indexing or using indexing. So those who are saying indexing they are correct. Okay. So this is about list. Let's talk about list methods. Okay. So definition wise we are good. We can take a quick example of a list. So I can say uh my list is 10 22.5 3 + 4 J and APC. In this particular list, can you see that everything is written in a square bracket? Can you observe that? So list you can also write a quick note. Lists are right. What about list? List are declared within the square bracket. Right? That's what we are saying. So you can say a list is written in bracket in square bracket or written using square bracket separated by comma brackets separated by comma. Okay. Yes, it can have my empty elements. Remember I showed you a list like it's a out list. I can create an out list as an empty list and then then what I'll do that I'll run off some computation some for loop and start filling in the list you remember that I made that comment right so this is basic Python okay so let's start with uh a bit of basic libraries basic way of writing Python script on Jupyter so see this is your Jupyter notebook okay and I'll give you a walk through of Jupyter notebook since some of the guys are asking I need to do it. So this is something you click here which is your user interface tool uh user interface tour and you can see that you can use left and right arrows to go through it. So this is your file name guys. Can you see that on the top then comes your notebook menu bar. See so this is your menu bar file edit view. So you have all those for your actions. Then you have notebook toolbar. As you can see the toolbar has buttons for the most common actions right so you're adding a cell cutting a cell right so this is known as a cell on the right hand side if you see my dear it is saying it has two modes edit mode and command mode I'll talk about it in a while now if you see that if it is in edit mode you will see a pencil here can you see a pencil right so means you can go and write your code that's your edit mode now command mode will be something then edit mode will have a you know kernel indicator as well for the notebook. So this is your notebook kernel indicator. So your notebook is busy or it is computing anything you see there like dot that black dot see here the black dot means your kernel is busy then uh notification area something you are happening it's happening with your Jupyter notebook you'll come here right what else I think that's it this is it then I'll give you some shortcuts okay let me just reload this Yeah. Now guys, suppose I have to write a code. I'll go and click in the cell and I'll say 2 + 3 and run. So while running it, I used the shortcut called shift + enter. And this is for Windows. To run the cell, okay, please keep this in mind. Can you see that? To run the cell, shortcut is shift plus enter. Everyone will try. You go into the cell, click and you will do 2 + 3 shift enter. Are you able to do it? No. Cell not not shell cell. If you see the cell here, shift plus enter. You have to run. Now guys, how to open a file? The moment you run, you will see a cluster like this. Can you guys see that? Local tree 8888. Everybody seeing that? So that shows your directory guys. So let's understand what is this? These are your files. Then these are the notebooks which are being run by me. Okay, a lot of it cluster not of our interest. So files is more like your directory. It's more like can you see that you have all the different things. So my all the classes comes here in the TL the silver lining consulting in that you have intellipad then we have so this is my folder structure you might be seeing different this is your 11th October batch and there once you are there guys can you see that so you can you can actually navigate to a particular folder of your choice and there or you can also create a folder but don't create a folder here create a folder like using the explorer And once you have done it, can you see this? There is something written new drop down on the new and can you click on Python 3. The moment I click on Python 3, it gives me a new notebook. Are we good? That's how exactly I created my this notebook. Everybody and then you have to name the notebook. You can click on this. You can give a name, write and then after that anyway I've explained now let's understand about little bit on the Jupyter side. So whenever you are running a code you have to go and you know add a cell. So to add a cell what I'll do I'll just click on this plus button. Can you see that the moment I do plus button it is it is adding the cell. And if I have to delete the cell or cut the cell I'll do the the scissor. Can you see the scissor there? Okay. Suppose you are in this cell and you want to run the code. Let's say I run I want to run 2 into 100. It should come 200. So there [clears throat] is couple of ways to run this. There are couple of ways. One is that you go there and click on run. You click on run, it will come 200. Can you see that? Or smartness would be that use the shift plus enter to run the cell. So when you're in the cell, you will press shift plus enter. Shift plus enter. That's one shortcut you have to remember. Then every time going there adding a cell is a very tough thing. So I don't like it. So there is an edit mode and command mode. Okay, you might be seeing I'm doing some cool heading and all. So how I am doing it? So to do that guys, you have to follow certain rules there. That is known as Jupiter markdown features. Okay, that is known as Jupyter markdown features. So what is it guys? So Jupyter markdown features can be used you know can be used to give you this kind of like suppose I'm saying you know basic Python welcome to welcome to Intellipan right something like I'm writing more like a heading can you see that it is also doing a more space so all those things what I'll do I'll share my notebook in the interest of time you can learn from it so you have to give a tilt sign here can you see that and Then you have to give not tilt sign uh just it is below the tilt sign on the same button on the keyboard and then you have to press you know in the command mode. So if you are observing very clearly when I press escape can you see the color turns blue. If you see this color this part you will observe that when you press enter you go in the cell it gets green. This is known as command mode. Command mode. when you press escape it becomes blue. Can you see that? So in the command mode and this written here right if it is blue it is command mode it's green it is edit mode okay and how do I remember it green itself has the word e remember okay so g all you remember g green means edit okay and the other is command mode in command mode you can actually get into this and you can change this cell to markdown feature or some heading or some code suppose I go and make it code right. It will not look that beautiful. The moment I go and select here that it is a markdown and with the hash you can give title. Okay. And with the with the that uh uh tilt button partner right that that quote you can give as your it's not the code actually single code it's some other other uh symbol you can use the monospace that should be enough for now okay we can keep adding more to it but yeah that should be enough for now so I'm giving few introduction for you in the notebook only so I'm writing here gentle introduction okay and I'll explain so that you're there but don't expect me to go and discuss Jupyter markdown features like a course okay now you can also embed images like this now if you understand I have already explained edit mode command mode press skip to go from edit mode to command all written just go through it in the command mode now you can do amazing things you can add a cell by pressing a button A and you can add a cell pressing a button B. A does above the current cell and B does below the current cell. Right? So let me show you this. Suppose this is my cell which is 2 + 3. If I run it is five. Right guys? Come on. Now in the command mode, listen to me very care very carefully. In the command mode if you press B, can you see that I'm adding a lot of cells below it. It's in command mode. And if I press escape and again in command mode if I press A means above the cell. Correct? Are we clear? Are you guys able to replicate this at your end? Someone is able to do it. Now sometimes you have to delete the cell. So one thing you can do the scissor the other thing can do in the edit mode. If you press D button two times, can you see that it has been deleted? See right? You can keep deleting in the command mode. So these shortcuts you can practice. How will you learn about all these shortcuts? I can give you the help. Edit keyboard shortcuts. All the shortcuts you will find it here. Okay. So you don't need to worry much on it please. And don't expect someone to help on this. Just read it, practice it, you'll get it. Are we clear on this guys? Because then this is this is never ending right. So I accommodated your request to you know go through quickly Jupyter notebook. What is Jupiter note all about? All those things. Are we clear? Perfect. Now let me move on to the proper concept. Okay. What do you mean by only B? To add you have to do in command mode A or B. Not shift or control. Only B only A. Okay. Above A, below B in command mode. Commands edit. Sorry. Yeah, this blue color. Now guys, let's talk about Python variable. Uh that's all about giving uh different titles of size. So you can try that out. Okay. Sometime give you two hashes. See one hash bigger two hashes little smaller. See can see this. So size will be different just like you have seen in word. See four hashes like this. Even tiner event tiny and the five means italic. Can you see the italic title are we cool guys? Uh to click is the edit escape is command. So I am in the moment I click in the cell it is edit mode green pencil. See here the moment I press escape it is command mode. Write write these these things down. Okay? Else you'll keep asking. Now let me talk about Python variables. You already have seen this uh this slide from my side. I'm just going to show you some quickly. How do you do that? X = 10. So here you are assigning X to object 10. Okay. Y = let's see if I say APC here you are assigning Y2 string. Okay. Now I'll run this guys and I can print it and this is print y. Can you see that it works guys? So this is to print the output. Okay, you know it just I wanted to write sometime people can say can you also show the type of this guy. So what is type of print of x? It should be integer. See here what type none I did opposite sorry print of type of x can you see that guys class integer this is what we were discussing yesterday right so I'm just quickly showing you hands on similarly you can say print type of y what you are expecting here guys come on if I do that you will get what class string see str is string is it working is Z can be your you know 2 + you know 5 J okay and you can say print type of zed see class complex what is left w = 13.5 if I print type of w float now I as I was telling that every object is has a unique ID which is what we call identity of a variable. How do you do it guys? How do you find identity of a variable? So for that you will be using this ID as the function. So you should also know the function. So this is your function guys. So ID of X we have defined four variables right? ID of Y ID of what was that? X Y Z id of W since you are doing multi-rint here you have to give everything within the print else it will not show in Jupyter notebook I hope you guys are able to code with me print id of Y and don't don't worry if you're not able to code everything with me you can skip that and you can practice later because you cannot match my speed uh but that's fine can you see that you're getting some uh numbers there unique numbers 1 2 3 4 all are different numbers guys. Can you see that? That's your identity for each and every object. That's your address in the memory. Sometimes someone can say can you also tell me hexadesimal code of this? Yes, you can say that. See this is your hexadesimal machine level code for the same object X. So you have the ID. See you have the ID and you can also print hexadimal code. Can you see that? Learn from me. Pick things from me quickly. Just let me. Okay. Now there's a question coming from Shel Sha. If different variables are assigned the same value, then address will be same or not. Right? So first of all big hand to shell. So this was from now guys I'll give you another shortcut and that is known as shift + tab. Shift plus tab is amazing functionality. It has an amazing functionality to show the documentation of documentation for the function or you can say you know syntax of the function as well because in the documentation you have syntax as well and syntax as well. Okay. So those who don't know shift plus tab can be really helpful while you're coding. I'll show you. Suppose I want to understand what you mean by hex. I'll do shift plus tab. Did you notice a cool thing has popped up there? You can drop down. You can also read return the hexadimal representation of an integer. This is a very simple function. Sometimes you can also find it by putting a question mark before the function and see it gives you have to not get this and then it will return. Okay. So ideally I don't like this question mark and all. I go with the shift plus tab. Everybody is able to do this. Shift plus tab. Try it out. You write any function. You can write uh id do shift plus tab. See returns the identity of an object. Now I'll quickly talk about multiple variable assignments in Python which I taught you guys. So I'm covering the base guys. Can you see that? Now suppose you had X Y Z W remember that. And then you had 10, you had APC, then you had 2 + 5 J something like that, right? And then you have 10.5. You have four variables on the left and you have four objects to be assigned to this. Right? See it works. So you can also print like X, Y, Z and W in one go. See guys is it working or not? Clear. Now naming convention in variable already I have discussed about it. Naming conventions right in Python. So you already know that you can say that you know my variable is my V right you can say 10. I'll give you a lot of one. You can also say my variable like V are equal to 100. That will also work. But you cannot say that you know 7 mahi equal to 100. See you cannot say that at the rate mahi at the rate 007 equal to something CSK something like that. I'm giving it th it throws an error guys right. What else? What else? Come on. You cannot also use like some keyword like uh print equal to 100 although it does but I don't think it's a good way of doing it. Let's see if I say for no here it will. So it's a it's a reserve word. For equal to 100 you cannot do because for is a reserve word for for loop. Are we clear on this guys? However, you can do mahi_mahi_7 equal to csk. That will work. So guys, you have to you have to try. You cannot do mahi 7 equal to csk, right? So hyphen does not work. So the best thing about variable uh convention is that naming convention is that you always use what I have taught you, right? my variable or you can say you know my underscore or you can say underscore I don't like underscore first because it has some other applications as well but you can say mahi underscore or mahi capital v r something like that up to you something like this 007 or you can say you know this is also fine it will work okay now I talked about variable names cannot have special keywords or reserve words. Remember that line of mine? So the question comes what are the keywords in Python? So keywords in Python are quite a few you can find all of it. But what are those keywords? These keywords are some special these words for coding right and they have special meaning and purposes and cannot be used for variable names. These are the three pointers I wanted to give. Now I'll talk about what are the keywords you have it look at the big list so all these are your keywords you can see that you have false non true and and is an operator uh very class continue def if else for loop for if is in lambda everything retry return pass while with so you have a lot of keywords in Python which cannot be used for your variable name. Is it clear guys? Now my recommendation for naming the variables is this that you go there and you say that okay lower case you use or start with characters with numeric along with underscore characters is not like special character alphabets. Okay, clear. Sometime people want to use double underscore that's that is something is is more like preferred for naming classes in oops so don't do that you might have seen some classes name like this then double underscore like this in python so that is for class naming convention so don't do use it okay clear then there are three types of quotes you must have been seeing list data type so I really like list data type because list is One thing I'll talk about I'll put a small heading here. I'll call this as data types. This single double triple quotes I will take it up in when I'll teach you string data types in that you know numeric complex float you have already seen I'll talk about sequence within that I'll talk about list. So I'm not going to get define uh again what is list and all but you already know that when you're trying to go through a grocery shop every day you have a list those who are married they know it and most of the time guys are getting list from their wives respective wives right I'm one of those guys so you you have to make a list like you'll go and you say I'll take a surf excel liquid. So that detail list you do top 2 liter. Okay. Then let's say you want to say okay I need some magni let's say six pieces. Have you done this 1 2 3 4 5 6. Come on. Isn't it this is an ordered list guys? Is it ordered? Look at these numbers. Yes it is ordered. This is the list which you have been creating every 3 days, every week. Right? you just did not understood that this is the same list which you're going to be taught today in Python as well right so it can be also a to-do list right you define your task for let's say a week and then you put it into the priority order right have you done it guys so I'll go for a passport verification important task cannot miss blah blah blah right have you done this in your life I think so then this becomes your basis is for understanding list. You already have been taught what is a list but this is also important for you to get a sense check. Okay, let's let's create a list guys. Okay, let's create a list. So if you create a list, let me go to my jam board. Let me take a shape and give it a peel of list. So now so I'm creating a list like this. Three four six. Let's say you have some number here. Let's say you say I say 100. I say APC right in the quote. Quote means it uh strength 7 3 + 5 J 3.14 and then I can say call this as BBC and minus 10. Are we cool guys? Now you clearly see that you have a list and the list every data types are different. integer class, string class, integer class, complex. Can you see that? Float string and then again integer. Are we clear? Now list is known as ordered. Why it is called ordered? It is an ordered collection of data. Ordered collection of data because of indexing. The concept is why because of indexing. So what do you mean by index here? So what list does guys? Listen to me. It start with zero. So you'll start here zero. In Python everything starts zero. So zero means zero position in this. So you have a cell right? You have like boxes there like or cells there 1 2 3 4 5 6 1 2 3 4 5 6 7. So indexing like what we will start zero and then increase it by one. So then it becomes what? One. Then this will become two. The positions I'm talking three 4 5 6. But if you see you're going from 0 to six ideally how many elements? It means seven elements. In Python everything start from zero. Always keep this in your head. This is never you write one. Then you are making a blunder. Okay. The good part about is this that this the positions which you're seeing on the screen this is known as what kind of indexing? Positive indexing. Why positive indexing? Anybody? Because you are increasing the counter by + one + one. So you're going forward. So positive only. No not + two. Are you able to follow me guys? So this is known as positive indexing. Now you have another cool feature that if this guy goes behind it like something like this then it also goes into reverse indexing. See from here if you are sitting here right you can either go forward means positive I like have I done walking guys you can either forward walk or this is forward walk or you can go backward also from here can see that and this is your reference guys okay when you're going forward this is known as positive indexing and when you're going backward This is known as negative index. So when you're going backward like you know you you're going backward you will come here now and then you will say oh this is -1 because 0 is already here -2 -3 -4 -5 - 8 - 7. So if you do the reverse you know of it you are still going to find that the last element of the list let me make a comment here last element of the list can be accessed by using minus one can you see that always can be accessed using clear guys are we are we compatible with this line of mind okay so this is known as negative indexing because you're going backward okay so Let me do one quick thing. Let me paste it in the notebook. So now what are your observations? Observations are very simple guys. What are those? It is heterogeneous means different data types. Right? The number one observation. What is number two guys? It is ordered. Ordered collection of data. Okay. It can have duplicate elements. elements items all are same not I'm also make a comment that not shown above I'm writing B not shown ever okay number four guys can be modified not yet to be discussed right these are the things which we have not shown but all these guys are the property of a list are we clear guys mutable okay so now indexing and slicing. So this is very important when you you know you take a list. Okay. So let me take our list and I'll call it as you know my list and I'll put some different things like uh string. I'll put a decimal. I'll put a complex everything right. I'll also put few more entries there. I'll also put duplicate items. Right? I also put minus 100. Okay, cool. Now this is a list you can see right now. Those who are wondering that how do I write this so fast? Use tab. Use tab. So how do you do use tab guys? Suppose you write my and then press tab. It will start showing the options available to you because this is already being in the memory. Can you see that guys? Are you can it try? Don't write my list l. Don't do that. It takes a lot of time. That's why you're slow. So if you are right M and then press tab, you will see a lot of options with all M. So you see there a lot. So you will write my then see. Are you able to repeat it at your end guys? And then what I do, I use my cursor to go and select and press enter. Please practice it. Smartness is all about if you can try to be smart then only you will be smart. If you keep practicing the same old rudimentary traditional approaches, you will not not be smart. It's all about practice. Done. This is my list guys. Now indexing means what? Indexing means that this 10 has a position. So suppose I want to access zero position element in the list. zeroth position element from my list. See how will I do it guys? I'll just go I'll say my list and within the square braces I'll place zero. Now I should be expecting 10. Let's see whether it comes or not. Is it coming guys? Right. Similarly you can now go and say okay so zero is 10. What about one APC? Makes sense. What about two? So you can do the counting like on your fingers and then validate it for the first time. So this is zero, this is one, this is two, this is 3, 4, 5, 6. Right? So two should give me 22.5. Right? Always remember it start with always remember it start with zero. Okay? So like that if you do my list 6th it should be minus 100. This is what we call indexing. So right so if I define indexing for let me write indexing is the process of accessing individual element within a sequence such as string you know list pupil or any other data structure right it's not only that indexing only for list okay make sense guys okay so all those uh options are there suppose I know the index I need the value I need I know the value. I need the index. You can do that. Let me go there step by step. Right? First element is always with zero. Right? But the last element last element of the list is what guys you remember I told you know you can use minus1. So you will see that minus1 will give you also minus 100 and sixth also give you the minus 100. Now the problem with the six is that it depends on the size of the list. Suppose you have a big list you have so many elements you need to go and count like a baby to understand that this is sixth or this is ninth position or 10th but minus1 is always fixed enough. So to always get the last element of the list you should always use minus one. Make sense guys? See are you getting the the point here? If you have a list having like 100 elements, you need to understand, you first need to know what are the 100, right? If it is not 100, you will not be able to get the last. Then it will be somewhere in the middle, right? Okay. So, last element can be accessed with the help of minus one. That's important for us to understand. Okay. Then there are lot of you know a lot of questions, a lot of concept can be coming on this slicing. So this is all indexing guys. I think the most important topic is list slicing. List slicing. Now let's understand list slicing. Okay. So this is my list, right? Where is the list? Yeah. So this is my list. Can you see that guys? I'm putting the screenshot here. Okay. So what do you mean by slicing? So I think you have also done a lot of slicing with the food. Give me a slice of Give me a slice of pizza. Right. So p uh pizza slide. You you slice. You take it, right? Give me a slice a piece. Right. So generally it's a it's a very simple English word slicing, right? Which means that you're going to in terms of list I'll talk about I don't want to give any uh ideas about the food, right? So slice is what? A slice is a subset of list. Technically speaking, subset of list, right? Or you can also say subp part or subset. You are right. So suppose this is my full list which I can which I'm showing on the screen. But let's say I'm interested in only getting this part and and you have to help me there. So I'm only interested from APC to BBC, right? I don't care about the other part. Okay? I don't care about the other part. Then how will you get me this? Are you getting? So then there should be a way out, right? Means we cannot just say that okay you go there, right? So that's where you have a syntax of start, stop and colon step. See those who don't know, please pay attention. That's why I'm covering the theory, right? So don't be distracted 100%. If you're distracted, you uh if you're distracted 100%, you're not going to get it. And it has nothing to do with uh anything else. It's all you. Okay? Start, stop, step. Okay? Now, this is very intuitive, right? Where to start, where to end, where you are starting here. Where you are ending here. And step, is it one step? Is it alternate step? Like jumping 111, jumping two steps. So that's how the syntax is all about right start stop step start is included in the sequence always remember start is included stop is excluded so if you put like I'll give example also don't worry about it so start is included stop is excluded by default step size is always one by default step is always one okay so let me let me give you A simple idea tell me one thing if I write my list my list 0 colon five what is the meaning of it means that you will start at zero stop at not five actually stop at five means you will only include till four right position four or you can also write fourth index that's correct till the fourth position or index. Okay, clear guys? But you don't see any other colon there, right? There's no colon here. If there's no colon on the step size, by default, you will pick. What is a by default here? One. So here step size is by default one. Are we clear on this case? So basically in this particular list, this syntax will give me what? I'm putting the output here. Start from zero mean it will give me 10. Then it will give me APC 1. So this is 0 1 2 3 4 5 6. So it will give me APC 22.5 3 + 5 J and BBC. Isn't it guys? It will not give me 10. That's what written here. Right? Start is included. See this box. Now you will be telling me the answer for the question we started with. Right? So I need that blue box. How will you give it to me? Now you tell me my list. What should I write? Where should I start with zero or one? I need APC start APC. See coming now. So this is clear guys. Now let me let me go to one more line. If I just write colon now, right? It means it prints everything from the list. It prints the full list. Prints the full list because the full list. Right? See if you do my list only this it will also do that. It will print the full list. So doing colon means nothing. It's just that it means give me everything. Right? But if you say my list and you say colon and then you say you know colon and two what is the meaning of this? So it means that can you remember the syntax start colon stop colon stop start colon stop colon step. Now here if you see you are saying colon means everything you will take from start till end but alternate. So it will print alternate items from the list starting from zero. By default it is zero. Hello. See isn't it? That's what exactly doing 10. Then it doesn't print APC. It prints 22.5 then BBC. See for yourself guys. Come on. So alternate items from the list starting from zero. Right? But someone can say I want to start from APC and then alternate it from not zero from APC. APC position is what guys one right. So what you will do go you will do there one. See isn't it easy guys? Can you see that? Now you want to say that no I don't want to APC to till the end. I want to stop at BBC or maybe the 10. So then you will say that for BBC you'll do five right 1 to five and then alternate see so this 10 is excluded guys. So understand what is the interpretation of everything here when I say 1 2 5 col 2. What is the meaning of it? Start at one stop at 5 minus one. So you will only include till four and then step is two. Read it. Are you able to read it guys? Come on. So 1 52 if you see here see one is what? This is one. So one five. Five is this. But I'll not take five. I'll stop here. So this is my box and then within the box I'll go alternatively. So I'll only take two points. Now APC and then 3 + 5. Hello. Now now let's say someone can say print the list in the reverse order. That's a very common interview question they ask all the time. That's a silly question but they keep asking. Print the list in the reverse order. How will you print it in the reverse order? Right? So what you have to do? You have to do it will take everything colon colon and then you will do minus one that's it nothing else. So now if you see your list has been printed in the reverse order just like when you were a kid you were counting 100 998 in reverse order. Now if you see here your list is 10 APC 22.5 you're starting opposite. How did it happen? That is important. So it is happening because of this 0 1 2 3 4 right 0 1 2 3 4 this is 4 5 6 but if you see the reverse indexing this is what minus one right so tell me one thing hold on if I say if I say zero and then I don't say step size + one if I do + one I'll come into APC now if I do + one I'll come 220 2.5. Now if I do + one, I'll come to 3 + 5 J. Right? Now guys, if I do + one, I go up forward. If I do step size minus one, so I'll go where there's nothing behind this. But there is what is it? See here? Last. Right. Right. And then if you do another minus one, you go to another last. Another minus one. You're just taking a step backward. You have done when you were a kid, you know, walking backward. Have you done it? Everybody does it. Why minus 100? -00 is the reason that it is the last point, right? So see here, this is my list minus 100. If you're starting from the last position, you will print it and then it will go. Now like this reverse means what? 10 is your first, 100 is your last. Reverse you start with the 100. Now, so this is not 100 minus 100. That's why it is coming minus 100. Okay. But start index is zero, right? No, not in this case. So what you have done that's I was trying to explain here the catch is that when you write colon colon and then you write nothing or + one it will start from zero. But the moment you write minus one the first thing first it takes a step of minus one you go to the last. So that's the only thing which you have to keep in your head. So if you writing + one it will start from 10. If you're writing minus one it will start from minus 100. Can we go from BBC to reverse and come back till P + 5 J like how do you want to go? You want to go like this? Are you saying this? Why don't you try it? Take mine and try it out sir. So you are saying colon minus2. Yeah. And then you are doing minus2. So it's correct now. So minus1 will be here step minus2 is here but why you are not getting it everything because you are starting from zero you're more like indexing it okay nothing like that you cannot get a sequence out of it getting that's the reason so this list so now understand guys let me take uh why we are only seeing 10 in index that slicing possible in reverse see what you are trying to do guys my score list suppose and you are saying that I should start from let's say any anything like you can say start from two and then you want to go till let's say minus two right so you can see that let's let's try to decode it now don't panic so when you're trying to do that you know from two so 2 is your 22.5 and then you want to go to minus2 so guys obviously to do 3 + 5 J BBC and it stops here. You also need to understand if you're writing 0 1 2 3 4 5 6 this is -1 -2 right and that's why when you write 2 to -2 so still it stops at minus2 which is not including minus2 means it will only include till BBC are you getting it look at the the the the one which I've written here so it's going forward but it stops at BBC why because because for it 10 is at minus2 this is tricky that's why you must not be getting it let me give another example my list if I start with two and I want to stop at BBC how will I write I want to start from 22.5 or maybe I can just keep the same example right if I want to start from APC and stop at BBC what I'll write in positive tell me 1 to5 right Yes, both giving me the same result. Can you see it now? Both giving me same result. Why? Because five is equivalent to write minus two. So you cannot be like you know doing like combination of forward and backward slicing. You have to do it two different list. Are you getting my point mean you cannot be like present and the past in both. >> Just a quick info guys. Intellipath offers a data science course in collaboration with iHub, IIT, Riy which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So, visit the course page link given below in the description and take the first step towards career growth with the data science course. Okay, so we are done with indexing and slicing guys, right? Let me talk about list as mutable and dynamic. So mutable and dynamic. Some of the guys must have seen X-Men. So X-Men movie talks about mutant you know normal human being and mutant. So in that if you remember uh mutants are those they have some you know some different powers because of their genes got you know the DNA or genes got DNA I think got mutated so they have a different uh personality trait in terms of power in terms of behavior right so similarly your uh these guys like you know list uh uh string you know dictionary We are also going to talk about whether they're mutable or not. Right? So if you remember there was one of the very uh good character which used to change the change the full body like blue color character mystique. So similarly right you can also modify or you can change the list but there will be some data type which cannot be you know which cannot be done. Okay so let me let me explain that okay so maybe I'll take a simple example to explain it that when I say mutable and immutable objects in Python what do I mean by that? So list definitely is mutable. But before I get into that, mutable versus immutable object in Python. So I'm going to put that heading guys. Mutable objects in Python. Okay. So write the first line if the state of the object cannot change cannot change after the object has been constructed. It is immutable. Right? That's my first point. If the state of the object can't change after right after the object has been constructed it is immutable. For example, I'll continue. For example, strings pupils I've not taught you. These are immutable. Okay. Continue and write. If the state of the object can be modified, can be modified, it is mutable. For example, list definitely list dictionary are mutable. I'm just taking example quick example list dictionary are muted. Okay, list dictionary are muted. You know we have to give you an idea that what do I mean when I say that definition is fine right? Let me take an example a cool example to prove my point. Suppose I say that this is my list. I have a list right guys and I need to find the index of the list right somebody was asking me all the time that how to find the index [clears throat] for anything let's say I want to find the index for BBC hello somebody asking that question remember I said that I'll tell you later so what is the index for the BBC definitely you can go and count but it cannot be count in a big data right mean suppose you a lot of data points. Can you go and count like you'll print the whole data on a piece of paper and then count? No, nobody does. Nobody does that, right? So here you can count that oh is it 0 1 2 3 4 right? But how will you find it? To find it there is a function called list dot index. So you have to give your list and you can put it. So what is your list name guys? my list dot index and there you will put the which one you find the index for uh which one you are trying to find it for BBC right it should return four can you see that Rudra and everybody it does return four right this is this is cool now since you know that BBC doesn't make any sense APC is like Akash pusher and what is BBC so let's say I say should be Rudra Patel right so I want to change my list. It has a mistake. So what I'll do, I'll go and put my index 4 and I'll say that it should be RP RPA patail, right? I'm just taking an example. So what will happen? Uh the moment I say at this position which is fourth position, it should update my list to what? From BBC to RP. That's what you're doing, guys. updates the fourth index position from BBC to RP. Are we saying the same thing is let's see did it do I think it will do. So suppose you want to now say see if you do this and you want to put something else it will not work because you have to do you have to understand that right the square braces is used for indexing and this is for your it's more for function generally function will always be start with the parenthesis okay and for indexing you know or filtering slicing you use square braces Okay, when you are writing a function, you will be using parenthesis where you're trying to slice, dice, indexing, filtering, searching, you will be using square braces. Okay, did you understand how to find the index and then you modified it? So that was step two. Step two is what? Update the value which we did. Good. Now there can be a task which I feel and I'll give you some amazing thing and nobody thought about it. If you see here in my list there are two tens. Can you see that? Yeah. Now coming back to that there are two tens. Can you see that? Now if I ask you if I ask you that my list 10, right? This is something I'm searching. What do you expect guys? Will you get the position for both the tents? Zero and and five. I don't think so. Try my list dot index. You have to do index guys. And 10. You will only get the first one. First index. In case of duplicate items, right? Suppose you have duplicate items. The list does allow duplicate items. You only get the first. So now I want to give you a task and you work on it. You think about it. Think how how will you be able to think how to fetch all the index positions for duplicate items? Would be a good question guys. List does not give you that right. How will you find it in a list? obviously in a list don't convert into a data frame and then you can then you can find it generally I do that okay now let me give you some methods now there's a question that what is the difference between functions versus methods functions versus methods what is it so let me let me help you with that so when we say functions okay so they are defined using which I'll teach you and I reach really good level of function using the def keyword. Remember I mentioned that define df define keyword followed by a function name. That's how you define a function. So function is defined like this by a function name list of parameters you give some arguments some parameters in parenthesis like this and a column to indicate the start of the function. I'm giving a like a definition. Okay, that's my first point. So clear this is what you say a function is. Now how it is different from a how it is different from methods is that see function is something which we create a function right. So generally they are userdefined function. Let me write another point userdefined functions. Okay. typically typically defined at at the module level. I'll explain what you mean module level. Suppose you're writing a a command, right? Or you're doing some applications, you're doing something. You will be you know creating a function a user definfined function at that level which can be used generally in global sense which can be used globally. So you can define a function right which can be used globally within the module. Suppose you are writing your this is your notebook right you have defined a function here you can use in this notebook any place right cool if you compare function with the method right method is not something which you define right it is part going to be part generally in in list right you can also define that I'm not saying you cannot define that but methods are generally part of the classes and objects right let me write that so methods are also functions you can use these interchangeably that are associated with objects or classes. Objects or classes. Okay. So now when you will be taught oops right I think I need to check on that that oops is in part of the the the whole thing which I'm going to teach. But generally when you will be doing oops you will see that you know methods are coming there. Okay. And the scope wise they are defined within the scope of a class. Okay. Using definitely the def keyword and a special parameter which is your default parameter called self. Remember guys those who have done oops those who have not done they can ignore for now. But that's how this right. So definitely you know both are same at which thing uh you can use right the difference is that function can be used independently right here it is going to be within the object and classes. So to conclude so I can write in in summary if I have to write in summary functions are functions are standalone if I can use this word a standalone piece of code that can be called independently while methods are functions that are associated with objects or classes and are called. So how will you call this methods on instances of those classes and instance means object object is an instance of you know classes. So so basically the whole idea is that how they are getting invoked that defines whether it is a function or a method. Okay. List is a class. You understand list is a class. I'll show you how it is a class. print type of my list. Remember this gives you the a class name. What is the class name? Can you see that list is a class. Now what is a class? What is an object? Right? That is not something we are going to do here. We will do it in oops. Okay, not here. So now if you see here, this is a class. So class will have methods or function. List will have methods or functions. Methods, right? It's very very simple, intuitive, right? have written on the on the screen. Right? So something few things you have to just take at the merit. Okay? Now when the list have methods then we are going to talk about quite a few methods. Right? As simple as that. Find the you know length of the list. Right? So what does this function does? It's very simple. It will use len. Right? Now this is a method. Right? Right? We can know generally length is we also call call the function length. So I'm telling you that it's not like very hard and fast. Right? But here if you say length you have written you have written a method which is associated with the class list. And now if I say length of my list it will give me what? Seven. Why seven? Let me show you. It's seven because you have how many elements there? Count on your finger. It is seven. Are we clear about the length method? You can say length also function can speak loosely. So length gives you the total number of elements in a list. Okay. Now this is fine. Now I'll talk about next method append versus append and concat. I hope these are another methods. So guys in the list we have quite a lot of methods. Let me show you. See here all these are methods all these are like classes. Okay. See whenever you see double underscore generally that is reserved for classes right. Sometime people also create object by this but these are all like jarens for you forget about it. But these are the methods which we are going to talk about it right especially append extend. So let me do that. Now if I talk about append now append is very important part right suppose you have two list you have two numbers list I'm creating two numbers list guys in one I putting the all the odd numbers okay up to 10 and in another list I'm putting you know all the even numbers up to 10 right now you tell me what does append class. So if I [clears throat] can give you the syntax for append. So this is it. And if I say you know I have a list right and if I say append and then if I go into it can you see that append object to the end of the list. That's what it's saying right? It appends one list at the end of the other list. Right? So guys you can read the syntax uh documentation quickly like this the way I have done. So what append does for you guys you can take a list right? So I've taken one list maybe I'll take my number one list append and then within the parenthesis I'll bring the other guy. Can you see that everybody please pay attention my number one is one list my number two is another list. Can you see that I'm picking one list and then calling this method append and bringing the other list. Now let's see what it does. See now if you see that my num one has changed. Can you see that? But if you observe it has so what we are doing here we are taking one of the numbers here. So there are two list. Okay everybody please pay attention on the screen line number 62 you have a list called my num one and you have another list called my num pair. Now what you have done you have taken this number two and appended with number one. Okay. But there is there is something which you have to pay attention right. There is some issue also that the output might not be you know the way you have you might have you might have thought that I should get output like this here what's happening when you're trying to append my num two with my num one. Can you see that you're getting a list getting appended to the whole list. Okay. Are you seeing the issue? This is an issue with the append. Can you see that there is an issue? You're appending the whole list only. You're not appending these values from the list. There's a difference. So what you're doing that within the list you have these numbers, right? 1 3 5 7 9 and then you have not added a number called zero to not like this. You have added a list there. Are you getting it? Right? And second thing if you can see and if you have observed what are the two takeaways let me write my number one list changes after append. So original list is affected. So basically what we are saying original list is affected that answer your question. Number two, append append function or method add a list to the list, right? And and maybe that's not the expected or maybe that's what that's what we don't need, right? Why do we need like this? So you might be looking out that can I get something like this? Let me show you minum one and plus minum 2. If I do that and now since the list has been changed right because of that can you see that this is the output is is something you might be looking out for it right guys right you wanted to bring these guys and be part of the first list but the problem here is that this is not append this function or method is known as guys I'll keep using function method interchangeably don't kill me for this and there's no difference as well this is not append this is known as quantity are you getting my point So whenever you want to chain one list into other that's a problem here with the append it does not work with concatenation it works everybody's clear on this now we have still not answered one of the question that why it was showing like this the reason is that append method is used to add a single element a single single element, single item, single data point at the end of the list. You cannot add more than one. If you try, you'll get weird answers like that. Are we clear? Only one value. Can you see that my dear? Add a single. I'm going to also highlight it. So now to prove it that I am correct, what I'll do? I'll take my any of my list my list one, right? So if you see my list one you have these numbers 10 20 30 40 10 20 30 40 in this if you append suchin jersey number and you put 99 you will see that it is now not misbehaving is it correct correctly showing guys can you see that just adding very nicely so when you're trying to give you're trying to give a list to it then it blindly takes the list and put it there thinking this is one object for it, right? Understand? Now, for a for a Python, this is also like an object and this is also like an object. So, if since append can only add one object at a time, one element at a time, it takes the whole thing as one and place it here. Why did it do and what is the solution? So, in this conclude, [clears throat] I talked about two things. One is that how to append one value to the list? You can use append. How to append a list to the list? Go for concatenation I'm also making. So that's why I like Jupiter. Do you see understand? And this is so this will become my notes right so I'm writing talking writing talking right so I hope this is fast at the same time very informative there is one more alternative to you and that is known as extend right let's extend to extend so guys again I'll say we have the two numbers I don't want to keep writing a lot of list so this is my number one guys see odd numbers and number two is even number. If you want to get the similar output which you are looking at my number one can be extended with my number two and this will be a loving form as well. Can you see that? It's exactly what concatenation does for you. Now the question to the group and generally when I take interview I ask this question then if both extend and concatenation does the same thing right? What are the key differences like what is the key difference between these two guys? Why we are having extend and you know and concatenation both what is the key differences extend versus concatenation? Right. So first of all concatenation is not a method altogether. It's an operation. Did you notice [clears throat] that I did not call any method there. But extend is a method is a function. See you use there what is an operation because you use the plus operator there my dear. Come on. But extend is a method. Number one difference. Concatenation does not affect the original list but extend affects the original list remember correct these are the two key differences if someone asks you throw at them okay now moving on there's one more so we have done what happened we have done concatenation we have done extend there's one more guy and we cannot ignore him and that's called insert I think somebody mentioned that this kind of question definitely I like you know what is the role of insert as the name suggests right as the name suggests insert is like insert right you'll insert something at some position right so if you talk about the function itself let me take a list my list this is my list. I want to insert something on this. So I'll say insert. And then this function says that you have to give the index and you have to insert the values you want. Right? That's what they're telling. Now so insert guys are telling see that give me a position and then insert. So I say insert at third and insert something weird like you know 999 so that I can quickly see that. Now understand this third 0 1 2 3 this is the third position guys. If I run this see what happens it has inserted exactly at the third position. Can you see that? So who was on the third 3 + 5 J. He said that dude you shift you shift here I will come and now I will become part count 0 1 2 3 are you getting it guys but if you can if you're excited that okay can I insert a list to a list right suppose I say dot insert and I say at third position insert another list my num one Okay. Now, do you notice that the list is already inserted here? So, why I did that? So, that I can show that if needed, you can also insert a list within the list at an index position. And there's no harm, right? Because see, read the documentation at an index position of your choice. There's no harm because see if you keep running it will keep adding because that's how it works. Okay, without letting you know. Now can you see that guys? Why it is able to do? Because for Python even a number 9999 is an object and my num one is also an object. You understand? Everything in Python is an object. So it doesn't differentiate that whether you are putting one value or you are putting the whole list. Are we clear? That's exactly what happened now. So what we have concluded guys, we have completed uh append. We have completed concatenation which is an simple operation. We have concenated h sorry complete extend and insert. Are we comfortable? Then take some more methods related to deleting or removing list elements from in Python. Right? So now we were like you know adding right adding element or data items to the list. Now I'll teach you how to delete things. So undo can be maybe dsha you can take it like an undo here but not really it's an undo. You are actually in another method you're doing code. So you're not exactly going back you are manually going back. Okay. Deleting or removing list elements in Python. So we can delete the list itself or delete the element or more than that elements one more than one from the list using below functions. Okay, let's talk about it. So this is my number one, right? Maybe I'm not happy with this list. I want to delete it. I can use the delete keyword to delete the whole list from the memory. It will not be in the memory, guys. It's gone. Let me show you. You will not be able to see that. Can you see that now anymore? As a matter of fact, delete can be used to delete the any object in Python. It can be a data frame down the line. It can be a dictionary. It can be a list. It can be an array. Okay, I'll be clear. It's very simple, straightforward. Delete and give the space and then you can delete it. As a matter of fact, delete can also be used Using delete keyword a single element can also be deleted but you have to give the position at a specific position can also be deleted guys don't try to match my typing speed I every morning I do the same right so now let's say in this list I'll show you hold up my list I'm not liking this nested list. Can you see that? Maybe it can be a bit confusing. What I can do? Let's say I don't like 40. Okay. So, what I can do? I can say delete my list one. But you have to tell the position of 40. So, you don't know the position of 40. So, you can be smart. You can say dot index and say 40. Hello. Can you see that I'm chaining two commands here, right? This gives the index of 40 and then it delete that. Hello. See guys, the first 40 is gone and it will only delete the first one in case the repeated deletes the first element if there are duplicates. Are we clear what this function is doing to refresh your memory? This function tells you the position index of 40 and then you place it here and then delete deletes. Now this is like okay this is fine you are deleting one element at a time you know all those things are okay but what about you know I give you a homework that you have to try deleting using DL delete method multiple elements right that could be a good point of right good good exploration area right how to delete multiple items right although uh there are there are other methods for deletion which I'm going to talk out but you can you can take it as a task you can take it as a homework to think about it okay now there are three more methods maybe I'll make it bold there are three more methods for deletion remove pop and clear right let's take one by one my dear remove what remove does removes the specific element remove the specific specific element. Okay. So now the question comes what is that specific element then? List methods remove. Remove has parameters right. So suppose I say my list dot remove. What are what is the syntax says remove? You have to give the first occurrence of the value. Can you see that? It gives you the first occurrence of the value. Okay. So let me give you a couple of pointers guys. Remove methods takes a single element as an argument. Are we clear? Remove methods takes a single element as an argument. Argument is the same thing the parameter. Okay. And then removes it from the list. Okay. And I'll do some formatting here so that it looks nice. Clear. If the element does not exist, it will throw an error. Okay, it kind of possible, right? What element you're trying to you know, you know, delete it. It's not there. So, if the element does not exist, let me type. It throws what error? A value error. Okay, let me show you this in action. Now my list. This is my list, guys. Now I want to remove, you have to give the specific element value. You have to give a name. You don't have to give the index. Suppose I want to remove BBC. It will do. See gone. But if you think can I also do this sir that if I give a list in that so I want to remove 10 I want to remove 22.5 right can I do this no it cannot do this because it takes a single element okay perfect so I also make a commentary error came because remove takes only single element as argument profit. Now you might be interested in deleting which is not even present there. Let's say I delete. I want to delete means remove like XYZ. It's not there. It will throw in what error guys? It should throw some error value error. Can you guys see that? That's exactly I've written here value error. It is telling that X not in list. So that is all about remove. You might be interested in deleting by index. Right. Right. This is you deleting by value. You're putting the value and you deleting it. If you want to delete by index, there's a method called pop. Understand? So what pop? Pop method does guys, pop methods takes the index of the ar of the as the argument and deletes the element at that index and also returns the deleted value. Okay, deleted item. Let me show you that. Suppose this is my list. Now I want to delete APC. Maybe you don't like APC. So you want to delete it. Simple. So how will you delete it? You will say it will go pop and you have to give the position. See now APC is deleted and also it returns that which element has been deleted. Guys follow me right? So my list.pop pop when I said one what I mean here at the first position what is the element APC it has been deleted right and it also returns the deleted item it is returning that APC has been deleted now if I print my list you will see that APC is missing can you guys see that sometime people will just write pop and they'll not give anything so what is by default it does by default it deletes the last element It pops the last element. If you're not giving any index, see minus 100 is gone. I have also written here. If you have missed if the index is not given, index is not given, pop deletes the last by default. You can you can keep doing that. Suppose you you run it again, then this will delete 10. Right? Now comes the last one is clear. What if I have to delete all the 10? So I'll go back and run again my list. And where is my list? Yeah, here is my list. So guys, this is my list. Now there was a comment that if I want to just delete okay, everything. So what it does, it flushes out all the elements from the list. But the list will still be there in the memory. So it will be an empty list. Let me show you. You can see that my list is still exist but it's an empty list now. Clear? So now there is a pro tip generally I ask as an interview question. Then what is the difference between delete and clear? That's a pro tip for interview. What's the key difference then? Come on guys. Delete deletes the list. Clear. Deletes the list. No. So again there are few you should always start with this if you want to impress your interviewer that first of all delete is not a method remember I mentioned but a keyword in Python. So let me show you you know uh directory of keyword. Yeah. So let me show you. So these are some reserved keywords which can see here right. Okay. Uh but if you want to really see all the Python list I have a very good command here. See can you see delete is a keyword my dear. This function which I have quickly given you import keyword. It gets you all the Python keywords which you might want to see. Hello. Right. pass you know you know raise return df delete can you see that delete is a keyword in python everybody please pay attention this is a syntax you can easily run later all these things on your own so not so again someone like xyz they will get panic what is this you don't need to understand everything sometime you can connect the dots when you are ahead of the dots looking backward you can connect the dots so these are the dots which are giving you you can connect going forward you cannot connect at this point. So you might because I've not taught you what is a for loop, what are these things which you are seeing here, right? So have have faith in me and and keep going. So delete is a keyword, right? So I wanted to show you. So delete is not a method but a keyword in Python. Let me complete this which is used to delete objects. or elements from a list. You remember you can also delete element from the list or the entire list. Clear. However, clear okay not that clear. Clear the clear. Clear is is a method in Python which is used to remove all elements from the list. You cannot remove one element. You have to remove the all element leaving an empty list. Okay. Perfect. So this is my list one. If I want to delete my list one specific element, right? So I'll go and say that delete position number four, it will delete. Can you see that position number four is what? 0 1 2 3 4. Position number four is 10. So if you see that if I print this list one, you will see that 10 is gone. Can you see that there's no 10 here? Can you observe my dear? between 50 and 20 there was a 10. So gone. But in clear suppose I say my list one dot clear it doesn't take any argument. It just say that if you do that this whole list is going to flush going to be flushed out. Can you see that? Gone. That's the key difference. And the moment you see this parenthesis, you know I have only talked I have only taught you just today that the moment you see parenthesis it means it's a method. When you don't see any parenthesis either it will be a reserve keyword or some operation. Right? So I think it's a keyword not an operation. Correct me uh correct that if you have written as an operation but a keyword delete is a keyword. It's not an operation. Okay good. So we have done the addition deletion. What is next? some ordering like reversing the list can be one of the task reverse suppose this is my number two and I want to reverse the list it's very simple guys you have to just take my number two dot reverse done now if you print it again you will see that it has been reversed the first position becomes the last and the last position becomes the first is it clear so reverse reverses the order of the It is as good as saying that you have done a slicing. So it is as good as doing slicing. Okay. Then I'll talk about sort. Sorting. I think these were some sorting is what sorts the list in the ascending order. By default it is ascending. But you can also sort it in ascending or descending order like low to high and high to low. Suppose I take this new list num list and I want to give a jumble numbers so that you can see that it's not a pattern. 9 tell me numbers guys. 17 23 99 12 11 4 6 90 101 Yeah. So this is the number list. Now if you say num list sort done by default it is ascending. You see that guys can you see that it has been sorted. By default it is ascending. I hope everybody knows ascending descending or you're also confused low to high. Okay, the same number list can also be sorted by descending order. For that you have to reverse equal to true. So sorts in descending manner high to low. Okay, let me show you this. Perfect. There's a question that if I say reverse equal to false, will it give me uh sorted? Yes, that will work. But this is like ascending. But ascending you don't need to give any com uh any uh function uh any parameter there. You can just not write anything. Still it will work. But you can write reverse equal to false. It's redundant. You don't need to write actually. Okay. There's one more method count and then we are done for the list. There are few thing I'll teach more but count what does count does? Count return the occurrences of it's not the length don't confuse it with the length of a specified element. How many times a guy has repeated in my list right? Isn't it? So suppose I take my list uh everything is gone. Okay. So I'll take a name names. Okay. So Akash barrage tell me a common name is what ammon you think nha is the most common name? Rahul. Yes. So I'll put Nha and Rahul multiple times guys. Robin not a very common name. Sachin and then again I'll put Nha and I'll put Rahul. Now you can clearly see that Rahul is coming how many times guys? Three times. Sorry. Nha is coming three times. Rahul is coming two times. Right? And now if I say names do count that's the syntax and you put that how many times Nha has come you can see three times how many times Rahul has come you should get two times are you getting guys okay so how count is different from uh length you should know that count counts it right so I think I need to reserve this uh when I'll teach you function I'll ask you to find duplicate item summary Okay. So this is a task. You can take it for later because you're not ready with function. But you should be writing a function to show the frequency of each item in the list. Hello. Are you getting what I mean by that? It means that I should be showing that a has come how many times? So it should be like an output like this. Akash like a dictionary you can say like similarly niha came how many times guys? Three times. Rahul came how many times? Just give an example three times. So that kind of thing you will be expecting right? So now you cannot do it because I'm talking about writing a function which I have not taught it yet but you can use some of your learning later. So these are task I think uh you have to do it. Okay, it's not that difficult. You can do it right away but you need to do for loop and the function. Okay, >> just a quick info guys. Intellipath offers a data science course in collaboration with iHub, I ry which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So, visit the course page link given below in the description and take the first step towards career growth with the data science course. >> Okay. So, I will talk about you know list copies and identity operators. Now let me talk about one list. It's a simple list from 1 to 10. And if I show you the identity of list one, what is the address? It is 22 331 you know 8360. Okay. If I take another list two and put the same content there you know terms of the data. Can you see that? What will be the ID of this? Will it be same? No, it will be different ID. Right? So you need to understand these two lists are equal. So if I suppose I test it by doing an equality operator, it will return me true because of the values in it. But location wise if you do the ID of list one, it's not true, right? You can see that on the screen guys and the reason is that list one and list two are two different objects in the memory. Okay. Now if I say x = 10 and y = 10, x = y is true. ID of x= to equal to ID of y. What do you guys think? It will also be true. Interesting, right? So ID of x and ID of y are the same. So what's going on? Very strange now. Okay. So it's nothing to do with mutable immutable. Now I'll move on to the next data type guys and that is strings. Uh string is another important data type. Whenever you're writing any alphabets right that becomes your string. Sometime people also combine alpha alphabets with the number that becomes your alpha numeric that is also a string right uh that is we qualify as a string. So let's say if I talk about a very simple uh text and that can be as simple as that. Welcome to basic Python course. Right? You might have observed double code there guys. Hello. Right? This double code is required to create a string. That's important to understand it. If you want anything to convert it into a string, you have to do the double quote. Are you getting my point? Or single quote. Right? See class is what? String. You could have done the same thing with a single quote also. See? And here also if I print the type of my text, it will be string only guys. As a matter of fact, you can also put a number as a text. How can you do that? Nothing. You just go and put in double quote my num text. If I print my num text, it will also look like a string and I can show in class as well. See 99 class string. Okay. In fact, I also created this string in the beginning, but I think you might not might not have observed this ABC and BBC, right? These are not numbers. Now, this is string. Can you see this double quotes? I think so. Right? Isn't it? So, now I'll talk about single, double, and triple quotes. Okay. So, let me put the heading guys. Single, double, and triple quotes. Okay. I think single and double you have already seen but there are some issues which we need to explain to you guys. If I talk about single line statement, it's very easy, right? Single line statement is what? So I can say my text again. I'm reusing my variable. Guys, today is the let's say fourth session on basic Python. Something I'm right. Can you see that I have taken a single quote, right? Same thing can be done with a double quote. And I'll make it my text one. This is good. Double quote. Okay. As a matter of fact, this can also be done by triple single code. This is known as guys triple single port. Can you see that? You might not have heard about it. Right? If you see none of them have given us the error, everybody is okay. In generally in the interview they ask that why do we need single triple quote see all of us all of these guys is working right today is the first session you are able to be generated the issue is not in this text the issue is in here suppose I go and change the text and just make an apostrophe today class is can I write guys going good I'm just taking that liberty But there's an issue. Can you see that guys? See, I have to really careful. The moment I try to do, can you see that there's an error? You know, there is an error because Python is getting confused with single quote and with the apostrophe. This is a real problem, right? As a matter of fact, you can handle this by using a double quote. That's fine. And you can see that it works. Let me print and show you right today's class is going good. You can still see that apostrophe. Yes. But there can be an issue in some other text right where you are going to say that today class is going within double quote you are writing great. Okay. So whenever you have double code within double code you still facing issue right you can see that right. So in all these cases you have to handle it with the concept of scaping behavior. So there's a concept called skipping behaviors. So what does it do? It says that wherever you see there is a character you want to escape you will just put a backward slash. So now this double quote you don't want need to confuse it and then it will work and you will see the double quote is coming. See guys are you getting or not. So guys in Python skipping mechanism is you know to include special character. It's not only for the double quotes or single quotes. for different special character as well. You can always use uh skipping behavior right by using a backward slash right or backslash. Sometime you will be seeing me in pandas using this r as a raw string uh new line as a you know followed by a new line character. So all those things are known as you know different way of handling it. Skip character I have just talked about it right. I think this is what I would like to bold it because this is what I'm going to use as of now. But the others you can just keep in your back pocket and forget about it. I'll talk about escape character is something we are going to discuss here. Okay. Now this is fine. This is fine. Uh sometime people write multi-line statement. Can you see that? This is a multi-line statement. If I don't give this backslash, let me show you. If I don't give this backslash and then try to do it will not print right it will not print it. Can you see that it is taking very differently. So what it has done it has just shown you the last line. Can you see that or as an output everybody observe this right? But if you take this and give it a backslash then it understand that oh there there is a new line coming right. And then if you see it prints it combining it. Can you see that? Although it's first of all I'm telling this because I'm supposed to tell you all those but we don't really need this much of things these things here because see our data science we're not going to do text analytics much right. So I don't want to spend a lot of time uh you know on these uh data types string or some other data. They're not very important. But I thought I should tell you this uh new line I think I I should can tell you right away because you might be thinking what is new line. New line is very simple. Suppose I am writing hello world right I can write. So now the moment I write hello world like this can you observe that I have inserted a new line. How to write a new line? You have to give a backslash with n. Always remember that right? And these are some rules you have to remember or follow. Right? Now we see that it has taken the same. Okay. Let me show you differently. First if I say that hello world it comes hello comma world. Right? But I want world to be go in the next line. Then how will I make it happen like this? Okay. Now I'm thinking the last bit on the is the multiple line statement where the single quote comes like a magic. I'll show you. Suppose I'm writing you know three lines. Can you see that? This is our Python class. It is going good. We are coding with the trainer. I hope you're coding with the trainer. Okay. If I run this, it's the same note I'm writing. Assigning the whole sentences to my note. Can you guys see that? But it is throwing an error because you are changing the line without the quote and everything. So definitely not working out. Another good use of single code is to manage the multi-line statement guys. Now I'll show you how does it do. Okay, I'll copy and paste the same thing. You have to do nothing. You have to just start with three simple quote. Generally when you're doing single quote or double quote and when you are in multi-line statements, right, it doesn't work. But if you do it with the help of single triple quote, you can manage multi-line statement like a boss. Let me show you the and you'll be happy to see. Can you see that guys? Although it is not a very flawless output. Can you see that it Python [clears throat] understand that you are writing in three lines three stanzas that's why it has introduced a new line a new line to tell you later that it was in new line. Are you getting my point? Okay. Now I'll say couple of things guys. I say my list. I want to compare something. my list I say names of the students. So I'll say Rashmi, I say Shalpa, Shiva, right? And I'll say my text. So I'll say Rashmi, Shilpa, Shiva. Are we good guys? Ive created two data types guys if you if you're able to observe one is list one is string can you see that see within that list also we have a string so don't get confused but this is a string data now if I find length of my list what do what do you expect the output will be it will be three because there are three names in the list three elements in the list right three names in the list that's why you see Correct. But if I find length of my text, what do you guys expect there? One. [clears throat] No 20. So what it has done? It has counted the character including the comma and spaces and everything. And then it's g. So what is your observation guys? What is your observation? Observation is that same length function is returning two different types of output according to the data types. Correct guys? Same function exhibit different behaviors as per the data types. One is a string, one is a list. And this concept is known as what? Polymorphism. I might have talked about it earlier as well. Polymorphism means poly means many forms of the same function. Many avatars of same function is polymorph. So I can take an example that at a woman as a woman a woman is like they take care of homes. Guys can also come here and say yeah we also take care of home but that's You guys don't care. I'm being improving me. We don't hand we cannot handle it. Okay. So guys can be like oh we are also there. We are not there anywhere. Okay. So we can't do that. Our polymorphism is unimorphism. Okay. Job is off. Job is job. So women play a lot of characters taking care of home family if they are working they're going to be a 9 to5 jobs or 9 to9 I don't know down the line kids. So definitely they have different roles to play. Guys roles are always only one. Okay. So that's where you can take this analogy and and relate it. Okay. Another important thing is that Python right if you look at uh let's say my text see my text and I I think that if I go into the my text and try to slice it index it zero means what I'll get R. If I say 0 till 10 and I want to do two two alternates. So you will get that R S M. Can you see that it is working guys? So you're getting alternate characters right good. But let's say if you say that oh no I want to replace R with so R position with something else. Let's say I want to say I want to do APC then it will throw an error and the reason lies in the concept that Python strings are immutable. Can you just can you see that guys? They cannot modify it. You have written the text you have written in stone. You cannot change it. Are you feeling it guys? Easy right? So why did I do this to show you? So that you can observe and see. See you are able to change the list. You can go and say in my list I can replace rash with akash or somebody else right so that is possible but here no that's how strings have been designed okay they cannot be modified okay now coming to the different string methods they are quite a lot mean quite mean quite obviously we don't need to do everything here it's really tough to do also like look at the methods capital I center you guys can so when you doing text mining text analytics I don't know if you have in your course or curriculum course curriculum some of these functions will be super useful but don't worry there are some amazing libraries for doing uh text analytics what is text analytics by the way but there are a lot of tools and uh technologies coming nowadays for text NLTK is one of them no spacey my god this is amazing space is one of them tell me Okay, Stanford also has I remember Stanford has a NLP module. Uh you can also use certain transformers like hugging space, hugging face. Okay, what else? What else? What else? I'm just trying to recall. I think these are the ones which which are which are coming to my mind. These are the libraries you might want to take a look when you're trying to do text and text. Now let's talk about some important uses of it. Right? So I think concatenation is very very important even for string. I'll show you why I'm saying that when I'll teach you pandas I will be talking about it. There can be a column called sq ID. Suppose you're ordering groceries on blanket or zeppto. So you have b sq means item. This is your item. You have b this item 1 2 3 4 5. Then you have a site ID, right? And that is let's say so suppose site is like your location suppose I by the way I live in electronic city in Bangalore. So you know you can say that my location is electronic city. So the item will not come from you know other part of the Bangalore right suppose I order groceries right it will come from the nearby location that's the location and then can be the customer ID which I also call custo ID so this will be like akash 007 okay this is a customer name are you getting guys although I'm showing one record of the data but there can be millions of record like this are you feeling guys and sometimes time to create a primary key to create a custom primary key we need to combine columns. Hello right you might have done in SQL as well right in SQL you don't combine you don't concatenate you just give the name of the column right but in in pandas or somewhere else you have to do that so what you have to do you have to take sq ID then it will say plus double quote and then you'll put a hyphen then you'll put another plus and it will say site ID can you see that then you again do the same you're concatenating with a hyphen look at Right? This is known as concatenation. Later on in pandas, you'll be seeing something like this. So you have SQ ID, you have a site ID, a customer ID, and then you're creating a key as a last column. And then this key will look like what we have done in panda syntax will be a bit different guys just to give you a teaser of it. This is how a panda syntax look like for the same stuff. So you can see right I'm not going to code because I don't have a DF means data frame primary key sq ID concatenation with site id with the customer id later on when I'll teach you panda I will do like in sleep goodbye now there are few more behavior string which string takes very differently for example if you do x= 10 and then if you do x into 5 what will be the output guess x = 10 x into 5 it will be 50 if I say x= a and then I do the same what do you think it will be APC five times not error it'll repeat so string has a different behavior altogether can you see that now differently there are a lot of string functions I'll show you some of them let me [clears throat] put here must know string functions right I believe upper and lower is something you should know because that's very easy right upper lower and title okay As some of the guys can already sense what I'm going to talk about upper case lower case yeah so suppose I take my string and I give a very different right okay if I do this definitely this is not the right format okay so I need to go into come on where is my string yeah and I want to make it all caps I'll do this upper all caps right guys see I can make all small that will be lower and I can also make a title title is like all proper it's known as proper guys I hope you're also coding like me copy paste copy paste don't type like every time now this is like a proper proper formatting clear this is easy upper lower title that's it title is like your you know right name you know you always start with the first letter capital then rest small like that okay very good now guys I'll move on to the split function of string the split is I always have felt that split is similar to text to column those who have used Excel they know it is text to column using a delimiter. So remember we had a primary key. Where is our primary key? Let's call this as primary key guys. Primary key as the name suggests split means you have to split. This is your primary key. I want to split this key into three different columns. Possible opposite of it. Right? So what I can do I can say that I'll take this primary key and I want to split it bases the hyphen. See are you getting now you are getting a list of having three different data points can become your three different columns. So what you did you use Python split function to split it into list of string. Can you see that? Okay done that is split. By using some special character you can give the like you want to split on what you have to give the separator okay maximum split I have to tell you so let's say maximum split is till how long you want to split sometime people don't want to split right people don't want to split let's say after this I just want to split these two guys so you can go and say that maximum split only two right sorry my that one. So now you can see that what it has done. It has only splitted your this SQ 1 2 3 4 5 and the other guy is still a combined work. Can you see that? Because you are controlling the split here. You don't want to go beyond up to one split. You are stopping here, right? Max split one is what you just want to split once, right? But if you don't want to control it, you don't give as a syntax, right? You just ignore it. Make sense? Now it will split it. SQ then here. Right? Can see that it's working good. Now I'll talk about the new function called sprit. Strip is very very uh very very important. Suppose I give you a text called greetings and it has a lot of spaces right. So something like this. It's a weird. Can you see that? something like that text is coming like this this weird possible in text anything can be possible now definitely this is not cool right guys does it look presentable I don't think so how we can fix it are we going to do and put you know enter enter no let's not do like you know let's not do like this there's a function called strip which is used to trim the white spaces can you see that removes the leading and trailing Remove the leading. Leading is this space and trailing is this space. Leading and trailing spaces only the leading and trailing. Don't get confused. Left and right. Okay. So now you can use greetings and you can say dot strip and you're done. Okay. Now the question comes how can I remove the middle spaces as well? Then for that you have to go to the text analytics right because you have to do some other uh functions as well. So one is stripping stripping gives you till here right. So this definitely does not do anything for the middle spaces. So then there is a function called join. Join. So now for the same one greetings. What does join do for you? Let me write one liner first. to join the words back together with a single space between them and you can you know you can actually join anything. So for example if I say join right something like this and then I say dot join right you can put anything here with a single space or any other characters between them you understand it's not only has to be single space if I recall correctly or any other characters or you can write any other operators okay and sorry why I'm saying operator any other string separator It can be a tab. It can be a you know colon comma all those things. Right? Now why I'm telling you this because I want to fix this middle issue. Right? So what I'm going to do first thing first I will go to split it. See now can you see that I have splitted it very successfully. Now this is let's say you have splitted it. Now what you're going to do you're going to say that now this splitted string in the list I will join with a single white space see right you are joining with what joining with white space let me show you you put a star here can you see that you put this look at this are you feeling it guys since we want to just join with the white space. I'll put a shift there and I'll join. Are you feeling it guys? Move on. Let's say join. After join I think we can talk about find. Find is also very useful function. Find. So what this Python find string right? Python string find what it does for you? it uh finds is used to find the index position. Index mean position of a substring important right in a string. Okay, maybe I can say a sentence and guys you don't need to type. I'm saving some time by copying pasting few of the things right now suppose I want to find that you know where is my word all is coming or maybe I want to find where where I've written guys right so how can I do that I can say sentence dot everything is very intuitive fine I'll say guys you understand guys then it will tell me that it is sitting at the 25th position I know it's little tough to count because of the characters but it is correct. Okay. I think generally after find I teach replace. So replace is also important. Find replace we do in Excel also. Now so let's say we want to say that Python string replace function. Now not only I'm going to find I'm also going to replace is used to create a new string by replacing some parts of the another string. Right? Let's say let's take the same thing. Suppose I say hello the same sentence and I want to replace dotreplace. You need to first give the the string guys and I want to replace it with what? How are you guys doing? How are you all doing today? Right? Can I say that? So now it has done it has replaced guys with the word all. Can you see that guys? And there is a question from someone that what does it count? You can replace all and count now. 1 2 3 4 5 6 7 8. Yeah, it it tells you the starting character of all. So, you're right. Right. Good. Connected. Okay guys, I'm done with string. Uh there's nothing more which I want to do in string. Okay, cool. Dictionary. So, dictionary is what? If you go to any dictionary, you will have something like this. So first of all again I'm telling uh another disclaimer that I'm not promoting any Oxford dictionary here. I'm not sponsoring anything. It's just an example empty. Okay. So what is the dictionary? If you see this uh in this dictionary there's a word called dictatorship. So then against this key you have a value right guys? Dictatorship is a word in the dictionary and then you have the meaning for the dictionary sorry meaning for dictatorship. So means what you are looking at a key and then what is the interpretation of it. So ideally dictionary the data type dictionary is also like a similar kind of characteristic ratio right they have a sequence it's a sequence data type and having key value pair. Now this key value pair has to be unique. Okay, has to be unique. It cannot have dictatorship coming two times. Are you getting my point? Right? No, no, no sense, right? If it is coming two times in a dictionary. So if I can give you some cool uh quick bullet points, you can see here. So dictionary is Python implementation of an associative array which is a data structure that is actually a key value pair. So you should focus on this. You can ignore the rest of the comments there or rest of the words. Generally you'll be creating dictionary with curly braces. Okay. Separated by comma. Okay. Now if I can give you an example of a dictionary, you can see this. This is a real example coming from pulp. So pulp is an optimization library in Python. Pulp optimization. And you'll be seeing dictionary data type is being used extensively there. Let me show you. So there are some examples like production planning platform uh problem. So have you seen that you know there are you know dictionary being used? Let me show you where can you see that? Uh maybe not this example a transportation problem. Yeah. So they're trying to so this is an optimization. Those who know mathematical optimization they will quickly identify. Pulp is the Python library to do optimization. You should definitely read about it. If you're interested in optimization guys can you see now you are having a dictionary here. Supply is a dictionary. Uh demand is also in the form of a dictionary guys. Are you able to observe this? It's all these are dictionary data type. So why I'm showing you this? because I want to prove or make a point that dictionary is a very extensively used data type after list. Okay, see here. So everything has a key and value. So a is a key and value is thousand. Can you see that? So this is key. This is value. KB another key value. All these are key. All these are values. Clear? So yeah I think then I can give you few more bullet points from my side. These are all simple. I've already talked about it. Okay. Now let's get into the business. So suppose I create the same dictionary called supply. To create a dictionary, yeah, I have to use curly braces guys and then double quote A. Then I have to give a colon and then I have to give some number. Suppose I I want to give a number. I'll give a number. I can also give a string by the way. And then B, I want to say 4,000 curly braces close. Then this is a dictionary ready. So if I print it, see if you want to really validate whether it is a dictionary or not, you can do that. I have taught you supply. Okay, it is a class dictionary. Now someone can say that okay can you fetch the keys of the dictionary? I need all the keys of the dictionary. Can you fetch in once? Yes, you can do that. How can you do that? Like this you can say supply dot keys and done. So these are your dictionary keys. Similarly, you can also find values of the dictionary guys. Now you tell me what are the values of the dictionary 1,000 4,000. Guys, look at this example. I'm using the same example. So if I do supply dot values, it'll give me values. Aar keys can be also string. So not a problem. You can make this as a string. Let me show you differently. Not here. I'm taking a very weird example. These are the student names with their registration ID. Okay. reg see does it work buddy but tell me one thing now I'll move on to my supply again now I'll go back to my dictionary supply and I'm going to do something and now this is this can be a question you can ask what if I do this what happens now I'm duplicating can you see that I'm trying to induce duplicate duplicate keys what are they a is coming duplicate two times, right? What will happen now? You tell me guys, what will happen? Whenever you are giving more values to a key, it will always update the dictionary with the latest value. Ideally, it should do it will not do anything. Okay. So suppose this is your dictionary supplies your dictionary. But suppose you want to find what is the value B, right? You can do that by doing supply under double code B that you can do so that we can access the value using the key. Okay. Now suppose you say that supply B hold on and I want to make it 10,000. This is possible. I just updated it guys. Can you see that? Right. So now when we say dictionary immutable it is in with regard to or only with the keys it cannot mutate the keys the values can be modified can be updated okay so don't get confused there you cannot change the keys suddenly okay so overall if you want to put it in the set uh I think since we are always talking about dictionary or any other data type with the values so dictionary in python are mutable okay so let me make it very clear I said immutable set only with the keys so don't get confused okay dictionary in Python are mutable but someone can you know probe you on that can we update the keys also care no you cannot do that so let me write in bracket only the values can be updated which which I have already shown right so that is something you have to be very careful when you say that okay that is my own intention I'll take a let Let me highlight it. Yeah, dictionary wise I think uh we are good guys. There are few things which are like you know uh time to time you will need it but trust me more than this the format of the data type is important. We are going to create a lot of data in the form of dictionary other than that we really don't use a lot of dictionary methods. Okay. uh to show you you can take a look at your end but I'm not going to talk about these and some of them are very much similar to you so dictionary if you see it has also has a lot of methods here splitting string more like a similar to string kind of behavior right this is dictionary only know I think so this is dictionary there's any update I think these are the methods in dictionary yeah so I'll give you some real world problem and then try to you know tell you that oh uh to solve this problem we might need these these functions and then tell you what are these function and then how we are going to use that is going to be my approach are we aligned on that I'll not be telling you functions name and start discussing that I'll be telling you that on the way of solving that problem I will make you learn few functions then on the other question I'll you know tell you some more function like that we will learn currently we were doing some functions right away like this because we really don't want to solve problem in each and every module. I will come back uh with this kind of learning on when I'll be somewhere around flow control structure and then I'll pandas. Okay. Okay. >> Just a quick info guys. Intellipath offers a data science course in collaboration with iHub II roy which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So, visit the course page link given below in the description and take the first step towards career growth with the data science course. >> So, pupil is another sequence data type. Uh it is also an ordered collection of Python objects. So it's it will be indexed right like what is at zero what is at one pupil are immutable which means they cannot be modified once they are created and to differentiate between pupil and list you will be writing pupil within a square within a parenthesis. So let me show you one. So my pupil is this and this can be also heterogeneous means you can put different data type within it. So you can put a float, you can put a string. Now let me show you. Can you see the difference guys? It is within the parenthesis, right? If I if [clears throat] I would have put a like a square braces, it would it would have become a list, right? Are you able to observe this? This is something you should observe. Okay? Now if you look at let's say if I say my pupil and if I say what is that zero you are not getting anything right see so my tuple zero gives me one means I'm able to do the indexing correct let's say if I do minus one I should get the last element what is the last element 5 + 4 z clear so definitely when you are able to look do this it means what it is an ordered collection of elements or objects right why it is order because you can do a numbering and you can access as per the numbering it's not like jumbled up and unordered are we clear on this make sense now uh when we saying pupils are immutable so basically we are saying that can I go to position number one and change it to BBC right can you see it doesn't work like this right you might think that will it work with the parenthes This is why don't you try that it will not so that's the point right means it is immutable okay it cannot be modified okay it is an order collection of objects now generally people ask me that pupil is something I have not seen much why do we need pupil so [clears throat] you know pupil is really very helpful and when I'll teach you for loop I will be doing this that in a for loop pupil can be used to iterate over multiple elements simultaneously. Right? So you can run a for loop over multiple elements simultaneously with the help of pupil. But this is just a statement. You won't understand much because you not you're not going to see an example which helps you understand. So, so for the time being this just take it as like with the on the merit right that when I say that it it is it is like this you just say that okay uh we'll wait for the for loop and I so don't dwell too much on this statement now but on the for loop someone should remind me that okay I have to you know illustrate this that how pupil can be uh used in a for loop that's my point make sense now there's a comment from sign can pupil have duplicate get items right so this is something you could al quickly you can also see right you go there and you can put another APC and see that does it take it simple I think it it should take so it can contain duplicate items are we clear I'm telling you it's more or less similar to list the only difference is that list is list are generated using a square bracket and pupils are generated by parenthesis Okay. Now, pupil does have some function. I see pupil have to be honest. Tupil has very limited application, very limited function. We should know about pupil. Maybe I can say that count is something we can just go through but we don't need to go and you know do a quite a lot of things there. So count what count does for us? Count gives the count of the specified element and index gives the index of this specified element. Right? Let me show you. Suppose I say my pupil and I say APC who will do dot count. Can you see that it has quickly counted that APC has come how many times? Two times. And then [clears throat] if I say what is the index of APC, it will give the index of the first one which is a general problem, right? We have been seeing this. Okay. So I think touch this is all on the pupil. Now move on to the set. There's nothing much to talk about it sets right. So set data type is something which you have already seen in your school days I think class 11. So set is an unordered collection of data types or objects or elements in Python. It contains no duplicate elements. It should not have any duplicate elements and it is mutable iterable. Okay, let me show you. So these are the pointers you can read can go through but let me create a set for so let me create a set. So suppose I say set one equal to now the good news that you can also create set using curly braces. So you can put the same things you can put APC 7.2 It can also have as a matter of fact heterogenous behavior. See now if you observe I started with one APC or something like that right but the the way set has picked it up it has done them some kind of sorting all the complex number right on the top the string will go last it's something it's I don't know there's logic to it or not but definitely it's not ordered right no I did not put any duplicates there duplicates is something now I'll show you so now if I put like you know APC or I put number one right or 7.0 zero I'm just repeating it and then if I run it it will take it but what it will do in the background it will remove the duplicates that's correct so here you can write this is after removing duplicates make sense now it is unordered means can I go and say that set one zero value is one you cannot do that set one set one if you look at set one zero are you able to iterate create it. Can you index it? No. Now let's create an empty set. And then people what people do even trainers do this mistake. They will say my set equal to curly braces. Right? But if I show you print type of it my set, it will become a dictionary. So that's the catch here. If you try to create an empty set by using curly braces, always remember that curly braces uh is for dictionary. Okay, you have to understand that. So let me write that that precedence is for dictionary, right? It is not for it is not set for set although you can create set by using curly braces. That's fine. But you should know that curly braces is reserved for dictionary. Let me write choir braces is list and parenthesis is pupil. Are we clear on this guys? This is what we have learned, right? This is what we have learned so far. Okay. So then definitely this is not correct. This is not correct way to create an empty set. But how will you create an empty set then? So for that you can use again I'll try my set equal to set. This is it. So the function is set. Now this is an empty set. See empty set. And even if you do print type of my set is class set. Okay. So let me I was looking out for you who who joined late today. Let me be yeah moving on. 1 3 5 7 these are the numbers which I have created in set. See class is set. So I put together you know four numbers. Now let's say I want to add a number to it. So the syntax says that uh you know nums dot add and I will add nine. So now what will happen? Nums will have a number added to it. Nine. Can you see that? So add is for single element. Okay. Let me also show you the add an element one element. Okay. And if you have if you have already that element it will not make any impact because it doesn't contain duplicates. Right? Then alternative alternatively we have update. So update is for let's say suppose you have another list of number. So I was saying that update is for a like suppose a number list right and uh I want to add more number right mean I want to add 11 I want to add 13 15 17 19 this is a list and I want to update my set by using this list I can just do this see now my number has the whole list is getting merged with it can you see that can I also do the same suppose I go there and I say nums do add and I'll put list there. Maybe I'll put 100 and 200 something like that. The moment I do that it says that you know you can unhashable mean you cannot actually pull a list into it and get it there. Can you see that guys? Difference between add and update. Add adds one element. Update updates more than one. Simple. Okay. Now we have done that. Let's try to also remove some of the guys. So suppose I want to remove an element from this set. Okay, I want to delete it more like this. So there is a function called discard. So what discard does for you guys? It removes a specified element from the from a set. If there is no such element present in the set, discard does nothing and does not raise an error. This is really not good that it doesn't give you any error. Raise an error. Let me show you. You have to just follow the the code. You can later you can copy paste from the my note or you can keep my node. So this is this is my number guys. I I want to remove the number 19 right? I want to remove the number 19. How can I do that? I think I can use this nums. Okay. And I want to remove the number 19. I'll just go and say that that number itself. Look at the syntax. Remove an element from a set if it is a member of the set. Member means it is in the set. Right? If I remove it guys, can you see that? nums do. 19 is gone. But suddenly you say that you go no discard 99. 99 is not there. So the problem is that the code executes. Can you see that the code executes right? But you will not be able to see that where it was 19 was there or not or you removed or not. Right? It's really painful. On contrary you also have another function which is known as remove. So this are discard guys. The another function is called remove. Remove removes the specified element also raises an error if it is not present. I'll show you. So nums I'll say nums and remove and I'll say remove 13. 13 is not a lucky number. Okay. Remove [clears throat] it. It is done right now suppose I say remove 99 it will say hello there's no 99 key error right can see the key means this is not found okay there is one more that is known as pop remember pops the element out and if you don't give any position it will pop the last element right you remember that but here since it is unordered Hold on. So here pops just removes an arbitrary element from the set. You don't know which which thing it will remove and we cannot even determine that what has been removed. Let me show you. This is my numps. Now suppose I say pop right. So remove and return an arbitrary set element. It doesn't tell you which one it will remove but it will remove something. So it has removed one. Can you see that? Now I'll print one nums. One is not to be found here. Can you see that one is gone? That's the that's the that's what pop does for you. Pop does an arbitrary removal. So generally people don't use pop. Either we will use remove or we will use discard. That's it in set. Okay. But there can be scenario that I want to remove multiple elements from a set. How to remove an multiple elements from set. So far we were just removing one by one. I might be needing to remove multiple elements from the set. So for example, this is my nums and I want to remove 5 7 9. Remove nums. I'll create another set and I want to remove five 9 and maybe 11. Let's say guys. Okay. Pop. You want me to repeat? See delete. Pop is very simple. It returns removes an arbitrary element from the set. You cannot define go there and say that okay you remove position number seven. You cannot do that right sorry uh the index number whatever you want to put there because it is unordered. So it cannot remove a number an element by specifically saying remove this one. It will only remove uh randomly. Right? I think it removes the you know starting position. So it's an unordered so you can try with some more. See now I think yeah it is starting from the first and then deleting it. Guys can you see that? So from the starting it is going to delete but does it give an option to set the index? No because indexing is not possible here. That that's something you have to keep in mind. There's no indexing which can work here. Okay. See pop works on index. Remember that in list I have talked about it. Okay. Now if you're good can we go to the next one. So this is this is my nums. Now I have removed already something. So I'll say I want to remove 9 and 11. Two elements and maybe 17 also. Right? I want to remove all these 9 11 17. Okay. How will I remove it? Multiple elements. So there's a concept of taking difference of set or set difference. You must have done in your school days. Remember that a minus b. So what you will do? You will take num set and you will say the minus remove nums. Right? You used to do that in your school days. So what you're taking? You're taking a best base set and subtract the remove underscore num set. That will give you the right answer. See beautiful right? So you are able to get the difference means you will get the 7 and 15. Now I'll go to the last topic on this union intersection [clears throat] difference is already I have talked about and equality. So these four topics I'll complete. So I'll take two set guys. Two sets 1 2 3 4. Please follow me. 5 6 7 set A I'll take another set 1 4 and 99 and 10 you can clearly see that 1 14 is common uh what is the difference between discard pop and remove okay now difference I'm going to talk about now guys tell me if I take this set A and this is my set B and if I say that I'll take union of these two guys union means But it will give me combination of two sets. Right? So can I say that a dot union b you will observe that it has combined these guys and keeping a unique all the unique one. If there are duplicates because see one and four is here as well. It is not repeating that's union. I'll not talk much on this. That's it. Intersection is common. Remember that intersection is common. So suppose I take a dot intersection and then I have to run this again. You should also do that then only the common will come out. Okay difference I'm being fast on these four because it is very intuitive. A dot difference B right see only the uncommon has come right which is not common. Can you see that except one four it has given the others right? Equality can also check. You know that these two sets are not equal. So it will throw an error. So if I say a= toal to b it will throw false. Remove multiple elements. How only two element particularly 7, 15 remove without mentioning. We have mentioned it. You guys have missed it. Can you see that I have taken 9 11 17 right? These three guys I have removed. That's why 7 9 11 15 17 these were the numbers from my side. Hello everybody clear 7 9 11 17 then I said remove this. Okay 9117 I have done the minus here. See so if you remove this if you remove this what you are getting bu Mr. Delete. Did you understand? Difference means what? It will take the uncommon. The same thing I've done here. No, just now. See here also I've done difference. Yeah, this will not affect the uh you have to save it on a new set. That's correct. Now the last data type and we are going to this is boolean. Boolean I'll talk in two lines. Boolean is B for boolean B for binary. Right? So you know true or false right mostly it is like that suppose I say a= to ABC balc so if I say a equal to b you get something called false right this false is what it's boolean only right boolean data type correct so boolean data type has two values two states isn't it guys either it it will be true or it will be false. Right? You can sometime people uh relate it with zero or one as well. Okay? So if I can make a commentary here in boole uh in Python boolean data type represents a binary value which can have which can have one of two possible values possible values and that is true or false. Okay, that is the pointer on what is boolean data type. Now where do we use it? So let me write booleans are used to perform logical operations make decision in control structure which I'll teach you very soon you know if else for loop and all that and evaluate the truth or falsity truth or false of expressions right just like we have checked one Okay, that whether a is equal to b or not, it says false. Okay, are we clear on this guys? I've given a very simple two pointers and it's not like that we have to always do a equal to b. You can also do that you know uh is it like five is greater than three here. Yes, true all those kind of logical operation you can also run conditional you can run. So this is this is what comparison right operators I'm going to talk you after the break comparison operators right. Okay, you can also think like logical operators. You can say that you know uh true false you can also do an uh logical operations and or and all that print type in which case can we get the output is boolean data type. So you go and print it now. So suppose you can print here type class is boolean. Can I see that operators in Python? What is your idea about it? My question is that what is an operator? Let's talk about first this. I know suddenly we'll start taking example. What is an operator? That's my question. So guys, let me go to my jam board. I hope you can see that. So I'm going to give you the definition of operator. So an operator serves as the keyword or symbol. Right? An operator serves as the keywords or symbol that are used to perform any operations. Any operation it doesn't need to have be you know have to be addition or you know assignment. So I take a very simple example I say two and three and I put a plus sign and the output is five. Right guys? If you look at this simple equations right? Can you see that you have number two and three they are known as what? Number two and three are known as what? Operants. Might have heard this word operand. Operants are those numbers or values or the keywords right? Not keyword numbers or values on which operation is going to happen. And this plus is what guys in this case it is known as arithmetic operator. Are we clear guys? And the name is addition operator. It is one of the arithmetic operators. The name is addition operator. So this is what you mean by operations. And this whole thing. So these are operators. Operates the whole thing can be put into a whole thing can be put into this whole thing can be put into a box and this can be written as operation. You have done some operation. Make sense guys? Now there are different types of operator we are going to study. What are they? Number one arithmetic operator. Number two logical operator. Number three comparison operator. Number four assignment operator. Number five membership operator. It's a big list guys. Number six, bitwise operator not binary you can say binary but it is bitwise operator and the last one identity operator. Some of the guys you have already seen but let we'll see one by one everybody. Okay. So this is the list of operator guys which we are going to talk about. Perfect. Number one, let's at least I think we can do arithmetic operators. Should be very fast. Arithmetic operators as the name suggest you will do some arithmetic operations like multiplication, addition, subtraction, division, right? You have been doing it for the longest time, right? The moment you started you you got born people started telling 1 2 3 right? So arithmetic operator is something a kid start with right? plus minus multiplication these are the symbols guys we have to use hello in that I think most of the guys must be knowing this what is an addition what is a subtraction multiplication division let's talk about exponent exponent is also known as [clears throat] power so like 2 into 2 2 into 2 is 4 but if I do 2 into 2 into 2 means what bad example you've taken a I'll try again if I write 3 into two it is what 6 but but if I write 3 into into 2 it is what 9 now you understand so exponentiation means power right clear flow division this is something people don't understand what is that so I'll teach separately modulus is remainder so suppose you divide 7 by two what is the remainder guys so modus is as good as saying remainder are we clear Now, now guys, let's talk about two-way decisions, right? So, if you focus here, two-way decision is going to be with if else. And if you focus here, guys, you will see that uh this is what I'm talking about. Suppose you are standing here. Suppose you are standing here. And you have to decide whether you want to go this side or whether you want to go that side. And that will depend on the you know criteria that criteria outcome will decide whether you want to go left or you want to go right. Okay. So let's get into the syntax. Suppose I'll keep it very simple. Suppose you take an input x. Okay. And there you say enter an integer. So this is your user input guys code with me. And now we are saying that if x is less than 100 print it is less than 100. Okay. And now you have that option of else. If it is less than 100 you print less than 100. If it is not you'll write it is greater than or equal to 100. Can I say that guys? And once you are done you can say print done. Right. I think given the situation we are in these days right? Given the situation they are in uh Kohi missing the century right in the last match definitely 100 is the is the is is being talked about. So if you look at this suppose he scored I think 95 right. So you can definitely run this and say that oh we missed the century right something like that right less than 100. Perfect. So this is very simple. There's no rocket science. I don't want to also confuse it, right? I want to keep it simple. Nested if else is this one. Okay. Now if you come back to the second second thing which I'm trying to say nested if else statement. Now why don't you guys try I'll give you the conditions and see that can you write this. Okay. So you give it a thought to think that you know how will you use this nested if else statement to solve this problem. So what is the condition we are talking about guys? Check whether the number is greater than 100 or not. Okay. Leverage the above code means this code and add nested if else block. Check if the number is less than 200 or more than equal to 200. also check if it is more than 200 then it is less than okay got it so the see here idea is although I've written in a very raw language what we are trying to do that we're trying to compare the same thing you know 100 versus 200 hello versus 300 are you getting guys that's the whole intention use user input leverage the above code and try to write nested if statement So we'll copy and paste this code. Okay, we'll save some time. Now I'll change this to greater than 100. I'll print greater than 100. And within this I'll write another if else. If x is less than 200 print less than 200 else print it is greater than or equal to 100 equal to 200 sorry and else print less than or equal to 100. I think I'm not doing 300 here guys but but now let's see if I do 1002 it shows that greater than 100 and less than 200 which is correct I think that's exactly probably also show right I have not gone to 300 but you can add right so it will show both the boundaries right now let me try something else if I say [clears throat] 200 it says that greater than 200 which is also correct and greater than or equal to 200 which is also correct. Okay. Suppose I take 201 greater than 100 greater than or equal to 200. Okay. And if I take 99 it will show less than or equal to 100. Sorry my bad. It should be less than but I think you can modify it and I think now you guys are champion. You can do anything. Okay. You can also contain it. You can also do the between uh condition as well. Okay. So guys, then you can try it out and you can extend it to 300 as well. That's fine. But let me show you that how does this nested work. Let me show you because that is important for you to focus. Now suppose suppose I run this I say 100 one. Now the moment I say 101 what happens guys? It goes and check this one, right? It checks that whether it is greater than 100. If it is greater than 100, it will get inside this. Okay? See, it will print that greater than or equal to 100. If x is less than 200, which is correct, right? So, you can see that it has entered this also. So what you can do you can modify this to say okay it is you know x is greater than 100 x is let's say if it is 200 if I want to modify this I can write a unidirectional greater than equal to 200 so you can say but no then then this will you know it will distort the whole idea now since it has it has entered the nested guys can you see that so you can see it is coming as less than 200 it [clears throat] printed this part of the if right let me show you something else I'll run again and then you observe suppose I say 202 now in ideally so if you see here what is going to happen let's run it through your mind this it will execute then it will 2002 definitely it will run this part of the block hello yes or no but it also knows that if x is greater than 100 it will print this but this part it will not print it will quickly jump to the else part. So in both the times it entered the nested if else but in one which I have just run it went ahead and printed the if body if body right body of the if and here in this new uh iteration I'm going to print body of the else correct so you will observe that every time either you are going to print this body of the if or you're going to print the body of the else. You guys agree with me? You can never print both of them. This is a fundamental concept. And this is your nested if else. You have another outer if else which is this one. Can you see that this is your if else but it is outer if else. So you can also say that nested if else is more like inner if else. Are you able to see that? What I'll do now? I'll copy this image and put it in your notebook so that you don't miss it. Now let me run that. So 200 submit. See now it will get into this. It will print greater than or equal to 100. Now did you notice it will check for this guy. Now you know that 2002 is not less than 200. you you are very sure that it will not go this part and do it. It will directly jump and print. Let me show you that. See now it has come directly here and it will print this. Can you see that? Let's move on to the next topic which is now let's move on to the last bit which is Python if else. Now guys I'm going to use if else if statement right where we are saying if l if else whenever we want to go more than two choices more than two choices means it can be three or 100 you are going to use it right so guys I'm what I'm showing on the screen is writing a program to give the season based on a month and month number are 1 to 12 can you see that if the month is anything from 11 121 which is November December January We call it winter. 2 3 is spring. 4 5 6 is summer. April, May, June. 78 is raining. Uh July, August. Uh 9 10 is autumn. And then anything which you give like 13, 40, 200, it should show invalid month. Idea is very simple. You're going to use if else l which is we are calling it L if and last. That's the syntax. Okay, cool. So what we can do, we can try to do some error handling like I generally do. So although I have not taught you this yet. So I'm using a more like a looping statement. You can see why and I'm saying that while it is true more like infinitely whenever till it is true I'm going to add my block of the code within it and I will also use so why I'm putting my name so that you don't get confused with a lot of answers enter the month between 1 to 12 right guys come on and then I'll say if my month is in between 1 to 12 and both equal see how I'm writing it guys see between 1 to 12 and I'll [clears throat] use break so this is another transfer statement else print invalid month please try again now this is going to be beautiful okay you will see that now if I'm saying if month is= to = 11 or = 12 or or= 1 I'm saying season is winter Right. LF now already I have this block. Then I'm going to print and I'll use a formatting. I'll say the season for the month. Now you will learn couple of things here and that is something I want you to read. These are known as format string is season c dot and the only thing which I also need to do guys season is winter since I'm going to use my code a little differently. What you can do you don't print it like this because I have copied pasted this. I don't want to print here. I just want to assign here. That's the difference. So I'll assign here. Now what I'm going to do I'm going to run this. Let me show you if I use 10 the season for the month 10 is autumn. Can you see that it is coming a little nice output right? See right see now suppose you give a different month then it doesn't just show you that you know invalid month it is still asking can you see that enter the month invalid month it printed please try again and again it will keep asking uh this is now you are okay suppose you you enter 14 then you enter some weird number it will keep asking it will not stop it will never give up it is an infinite loop till the time you put a Right answer. Interesting. >> Just a quick info guys. Intellipath offers a data science course in collaboration with iHub, IIT Riy, which will help you master concepts like Python, SQL, machine learning, AI, PowerBI and more. With this course, we have already helped thousands of professionals in successful career transition. You can check out their testimonials on our achievers channel whose link is given in the description below. Without a doubt, this course can set your career to new heights. So visit the course page link given below in the description and take the first step towards career growth with the data science course. >> Python loops. Okay. So looping statement is one of the most important functions you can say or the features in Python I think or any programming language. So without looping statement uh I feel nothing can be done whenever you're trying to repeat any task which you want to do uh sequentially one by one. uh so you're not going to write multiple lines of code for every bit of the task right you generally tend to use for loop so before we get into what is for loop and all I always start with the question that why we need to use for loop what is the reason for using for loop why do we need to use for loop so I I can give you some reasons guys let me also write okay definitely number one is iterations And whenever we want to do a definite iteration, definite is for loop, indefinite is while loop. Always know the difference. So whenever you know beforehand how many times you're going to run the loop, that's called definite iteration. Means you know how many times it run 50 times, 100 times, thousand times, right? And when we run this you know control loop, right? Uh to do some repetitive task, right? Uh definitely that's one of the most important use of for loop. It can be as simple as that. You want to do the cumulative sum of 50 students right cumulative sum of 50 students marks. So you will start with student one two his marks is 80 his marks is 90. So you keep going right like 80 will be the first one then 90 will add it will become 170 then you will add 60 it becomes 230. So like that you're going to repeat and also do some action. So you are not only iterating the marks scored by the students you're trying to do a cumulative sum so that you can use it somewhere. So whenever you're sure that you know how many students you have let's say your class has 100 students you will run this for loop how many templates you run it for 100 times. Okay to to get the cumulative sum till the last student and then you can divide by the number of student to reach a value called average marks. Right? That could be a one of the simple example for a definite iteration. Second important reason is why do we need a for loop is to reduce the course complexity. Just imagine that you're writing multiple block of codes for repetitive task right. So definitely it doesn't look good doesn't look a clean code and not also as per the best practices. So to maintain the clean code right clean code environment right where you don't want to write lengthy code or messy code right you will be needing for loop as a more like a tool for you whenever you want to run an iteration of repetitive task you go and use for loop when you don't know how many times it will run you use a while loop right so you do things in an efficient and clean manner right so let me give these pointers as a node notes so that you can read through it. Then I also mentioned few things like you know indexing and enumeration. So what I'm trying to say that uh for loop can provide access to the index or position it's the same thing of each item in a sequence which can be useful for tracking the order of items. Okay. Or for reference we might need to you know refer later which we can do that which I feel that is one of the other reasons we should use for loop. One more reason which is coming to my head is that you can also use for loop for searching and matching. Right? It's not to do some mathematical computation. Always people think oh for loop is only for mathematical computation. It's not correct. It can also be used for to search specific element although not a very computationally good thing to do but you might have to or find patterns in the data. Think about textual data. So these are the few things which I am trying to highlight this. Okay. Why do we need for loop? Now if I have to quickly define what is a for loop. So I'll I'll show you this uh definition block from this slide. Uh a loop in Python or any pro other programming language which can iteratively execute a piece of code block till the time condition is being made. Okay, till the time condition is being met. Okay, so this looks little you know this looks little not very much clear. What I'll do, I'll get into my jam board and try to you know outline this. See, we are talking about for loop. Okay, always remember that when you are trying to do for loop uh use for loop, you are going to talk about sequence always. So that's why we start by saying that for each element in sequence for each element in sequence for each element in sequence you go within the element and you will ask this question that is this element is this last element of the sequence is this last element of the sequence that's the question mark guys and if the answer is no. If the answer is no then it will execute statement inside the loop. Now the condition you're looking out for the condition you're looking for is this one only. Is this the is this the last element of the sequence? If it is no, it will execute this statement inside the loop. And my dear, please pay attention. This will keep going on. It will come back again, pick the next iteration and again check it that whether is this the last sequence or not until the time it is no, it will keep running. The moment it says yes, it is the last element. So you'll come on this side. Let's say this is yes. Then your for loop will end. Are we clear guys this end of fall? I'm writing that this is the most simple for loop I have written. This is an example only. This box is for condition. Okay, you know right decision making box. Okay, let me put this in the notes. Now guys, I'll talk about the uh the syntax. It's very simple as you can see on the screen. And let's pay attention and get it right for each element in the sequence. Right? So you're you are writing for that's your keyword element in sequence in is also a keyword. This element can be also written as I J K your name my name and then the sequence will be a data type. It can be a list. It can be a data frame. It can be a text. Then you're going to run the body of form. So let's also understand what is element. Element is the variable I also call it that takes the value of item inside the sequence on each iteration. So basically what I'm trying to say here that every time it will pick the element present in the sequence or item present the sequence and keep iterating till the time the condition is being met. I'll show you. So let's say I is equal to 1. then it will pick two then it will pick three and so on so forth. Then the second thing is that all the in statement inside the body of the for loop this is your body right will be executed okay with the same value of the iterator okay suppose you're using some statement like element into two so it will take the element value for that particular iteration and multiply by two that's what we are saying in this line okay the other thing which you can observe my dear is that there is indentation can you see that there is four dot space or four white space Right? You have to follow that just like you're following in the if else. Last one is that loop continues until we reach the last item in the sequence. So that's how it works. Okay. But you can control it. It's not the very standard thing that you have to go till the end of the world. You can stop somewhere in the middle also. But you have to put a condition to that. You have to subset your loop. But end of the day uh subset your sequence. End of the day sequence or you plug in here. it will go and cover till the end. Okay. Now what I'm going going to do I'm going to run a simple for loop. Let's do it. So I'm going to write our basic for loop. Okay. So I'm going to take my item as a you know nums which is going to be a number 1 2 3 4 5. I'll not keep quite a few because then you'll get confused. Then for I in nums. Okay, I'm going to just print I into two. Clear guys, what what what are you expecting from here? Before we run this, let's let's break it that what are you expecting out of it? And you have to understand right what we're trying to say here. What's happening? Uh what is this nums in our language of for loop it's a sequence but data type is what list sequential data type list see sequential data type is list right then for I is your element which we are talking about this right remember element in the sequence and then what you're doing you're going to execute this line of code which actually says that take each element and multiply by two and then print it. Simple, right? And then print. Can you also observe that there is indentation of four white spaces. Perfect. Now what is the expected output? You will take 1 multiply with 2. 2 4 6 8 10 will be the expected output. Right guys? Come on. And if I just run this, you will observe that that is true. Correct guys. First line of code what it will do? It will create a global frame list. See? Done. Then it will go in this iterator and it will pick I in nums. Now since you've given the list as as the as the as the you know sequence, it will pick the first. So I will be one. See then it has gotten inside and it will print I into two on the top. You see then again it has come back here and then iteration the iteration you can say that the counter will increase from here to here. Right now it will pick two. See guys observe 2 into 2 4 like keep going like this. See till the time you're done it will keep going like this. Okay. If the sequence is like millions of items, it will run million times. I'll be clear guys. Now guys, for loop is really interesting. But before we get into for loop, I need to you know teach you not really teach because you have been taught. There's one more thing which you should know before you get into for loop. The depth of the for loop is range. I hope everybody has been taught range earlier but if not let me teach you now. Okay. So ranges is is a very simple function which we have three syntax uh sorry three uh parameters in the syntax which gives you a sequence of number. You can give start, stop and step. Start is your starting of the sequence. Stop is stop of the sequence. So suppose 1 to 100. One thing you should always keep in mind that stop is not included. Right? N step is like you want to take one step, two step, 100 step. What is your step size? Right? Let me show you with some example. If I say range five, okay, then you will not be able to see what is what do you mean by range five. Range five by default means stop five. Stop five and five is not included. Always remember that five is not included. So what is included guys? 5 - one always the last minus one. So what is 5 - 1 guys? Four till four you can get it. I'm writing this like like a baby because people get confused. Now suppose you write next time range of 10. Don't say four is still four only. No no no 10 minus one. But how will you see this is definitely a sequence. Just do list of this guy. Then you will see that you have generated a number like is telling 0 1 2 3 4. Can you see that maybe? So what range gave you? Range zero range of five. Range of five generates numbers from 0 to four. But how many numbers are there my dear? Five. Can you can you see that? Sometime people say no no no I need step different step right. So I'll say okay fine you want to go till you know 1 to 11 10 numbers but alternatively see step size two means what alternate right every second three means every third are we clear guys so range is very important in for loop and that you will understand with this infographic see range can be used to also iterate I'll show you if you see this simple for loop for i in range of five. So basically you are getting a sequence and it will start from 0 1 2 3 4. So if you observe on this cycle zero is your i = first iteration. Can you see this? Second iteration is i = 1. Third iteration is i = 2. Fourth is i3 and fifth is i4. Always remember that python is always starting with zero. Keep in your head. Let me show you this. If I say for I in range of five and I just say that do I into means you are printing square of I square of I is you you have just written a pool function called square of the number I is I hope you know you can do all those things like multiple print commas. Let me run. See square of 0 is 0, square of 1 is 1, square of four, square of 3 is 9, square of four is 16. Do you see just using certain text in the print I have made it looking I have made it a bit presentable. You agree guys? Now a simple task. Let's let's do some question. So first question guys, print all the even numbers. Very simple question. Print all the even numbers from 0 till 100 both included in a line and use for loop. Sometime this is not required that you will use a you can use range also. So please use for loop that's the condition. Okay, let me do it. This question has nothing to do with the for loop but let me do it. See definitely we will use for loop I in range okay and you can just use the logic okay that you only pick the you know every second item and then print it okay but this is not the right way because suppose if you're writing range 0 to 1012 then why do you need a for you should do something where you have to use the logic Okay. So what you have to do you use model and if you equal to zero remainder is zero. So the idea is to use some logic here and then you will say print I. Now when you're trying to print I this will also work. Yeah. So you can see that guys you must be getting this as an output. Right? Correct. But I don't need this right. I don't need this for i in range. 0 1 0 1 2. So what you're doing guys, you are just doing this. So ideally you have created your you know you have created your sequence in that manner only. So there's no intelligence mean you are already telling I'll pick 0 to 4 then go and print. So then why do you even need this? Then you just use the range and print it. No. So if you're using for loop I understand but it's not still that uh that good. So this is a better one right to use for loop and show some condition some logic. So this is your uh some condition statement you have also used and then you are going to use a command called end. So end by default is always set to new line. Okay this is in print only by the way. But if you give a space then what it does it set it to the space as the separator not the new line as the separator. So let me talk about it little so that you don't miss it. You don't miss it. The end parameter is really cool parameter in print. The end parameter in the print function is used to specify what character should be printed at the end of the printed text. Okay. By default, I'm just writing in my own English. And is set to what? And is set to the new line character. Remember new line character, guys. You don't need to type I'm doing for you. This is your new line character, right? And you already know what it does. It will always put it to the new line, right? But if you are doing this, doing end equal to this sets the end parameter to what to a space character. So after printing, let me complete it. After printing each value of I,
Original Description
🔥Enroll for Data Science Course: https://intellipaat.com/data-scientist-course-training/
🔥𝐁𝐨𝐨𝐤 𝐲𝐨𝐮𝐫 𝐅𝐫𝐞𝐞 𝐌𝐚𝐬𝐭𝐞𝐫𝐜𝐥𝐚𝐬𝐬: https://forms.gle/g5tExa7e54xpYZW97
🚀 Master Python Programming from scratch with this complete Python Full Course covering Python Basics, Variables, Data Types, Lists, Strings, Dictionaries, Tuples, Sets, Operators, Conditional Statements, Loops, Functions, NumPy, Pandas, Matplotlib, and Python Interview Questions. Learn essential Python concepts such as Mutable vs Immutable Objects, Global Variables, Multiple Variable Assignment, List Methods, String Functions, Data Structures, and Control Flow. This beginner-friendly Python tutorial includes hands-on coding examples and practical exercises to help you build a strong programming foundation for Software Development, Data Science, Machine Learning, Automation, and Web Development.
📚 Whether you're a student, beginner, aspiring Python Developer, Data Analyst, Data Scientist, or Machine Learning Engineer, this Python course will help you learn coding fundamentals, problem-solving techniques, object-oriented programming concepts, and industry-relevant Python skills. Gain hands-on experience with NumPy for numerical computing, Pandas for data analysis, Matplotlib for data visualization, and prepare for Python interviews with commonly asked coding questions. Start your Python journey and become job-ready for tech careers in 2026.
📖 Below are the concepts covered in the video on "Python For Data Science Full Course ":
00:00:00 - Introduction
00:01:26 - What is Python?
00:04:08 - Basics of Python
00:05:34 - Compiler vs Interpreter
00:17:42 - What is a Variable?
00:23:28 - Variable Differentiation
00:24:15 - Declaring vs Initializing a Variable
00:28:03 - Multiple Variable Assignment in Python
00:32:05 - Naming Conventions in Python
00:37:14 - Global Variables in Python
00:41:39 - Data Types in Python
00:46:14 - Numeric Data Types
00:53:43 - Sequence Data Types
01:01:23 - Bas
More on: Python for Data
View skill →Related Reads
📰
📰
📰
📰
One Parser For Every Lab Instrument Export
Medium · Data Science
Your Gold Table in lakeshouse Is No Longer the Finish Line
Medium · Data Science
The Importance of Power BI in Data Analytics: Why It Matters for Modern Data Analysis
Medium · Data Science
Z-Test: One Formula That Helps You Test a Business Claim
Medium · Data Science
Chapters (14)
Introduction
1:26
What is Python?
4:08
Basics of Python
5:34
Compiler vs Interpreter
17:42
What is a Variable?
23:28
Variable Differentiation
24:15
Declaring vs Initializing a Variable
28:03
Multiple Variable Assignment in Python
32:05
Naming Conventions in Python
37:14
Global Variables in Python
41:39
Data Types in Python
46:14
Numeric Data Types
53:43
Sequence Data Types
1:01:23
Bas
🎓
Tutor Explanation
DeepCamp AI