Python Tutorial For Beginners 2026 | Python Programming Tutorial | Python Full Course | Simplilearn
Key Takeaways
This video tutorial covers the basics of Python programming, including data types, variables, control structures, functions, and object-oriented programming, with a focus on data analytics and science.
Full Transcript
[music] >> Hi there. Welcome to Simplilearn's YouTube channel. If you are looking to start your journey in software development or data analytics or data science or generative AI or literally any IT domain, you see one skill in common and it's Python. In the current IT industry, Python powers some of the most exciting fields like AI, machine learning, data science, data analytics, software development, web development and the list goes on. That's the true power of Python. And don't go just by the looks. Just because the list is long, the Python learning journey doesn't have to be so long. Trust me. Even if you have never written a single line of code before, you can start and still easily follow along and learn Python. Python is so simple and the syntax is so readable that it shrinks the learning journey exponentially so that one can master it in less than a month. In this course, we are going to start from the absolute basics and gradually build your confidence step by step. Having said that, let's discuss the agenda for today's session. We will start off with a basic introduction to Python. Then we will look into Python variables and data types. Followed by that, we will take a look into Python collections or also known as data structures in Python. Here, we will learn list, tuple, set, dictionaries, strings, etc. Then we come across operators in Python. Up next, we will have conditional statements in Python and then we will dive into loops in Python. And lastly, a quick introduction to Python object-oriented programming. This should give you a basic foundation understanding of Python to proceed along with your learning journey into data science, data analytics, AI and machine learning or software development. That's it. If these are the type of videos you'd like to watch, then hit that like and subscribe buttons along with the bell to get notified whenever we host. Also, just that you know, if you want to upskill yourself and master data science and data analytics skills, then you must explore Simplilearn's world of various science and data analytics programs. Simplilearn offers various master professional certifications and postgraduate programs in collaboration with some of the world's leading universities. Through our courses, you will gain knowledge and work-ready expertise in skills like Python, Tableau, Power BI, generative AI and over a dozen others. After completing these courses, thousands of learners have transitioned into a data science or data analytics role as a fresher or moved on to a higher paying job and profile. If you are interested, then make sure to check out the link in the pinned comment and description box below to find a data science or data analytics program that fits your experience and areas of interest. Now, let's get started with our Python course with a small quiz. Which Python data structure is ordered and mutable? Your options are A, tuple. B, set. C, list. And D, dictionary. Please do let us know your answers in the comment section below. Now, over to our training. So, we can start by, you know, having a quick walk around of how to install Python. So, I've already got the Python installed, but in case if you're new to this, then you can just pause the video and go to this link where you will understand how to download Python. But also, I'll also again give you a quick briefing. You can just navigate to python.org and here uh you can just download Python and get it installed. And then we have another option as well. So, we can also install Anaconda. And if you just download and uh just go through the basic protocols and recommended settings by Anaconda, you'll have everything installed in your PC. You can also uh check in every other box that uh the installer shows you. You can add the Python path file to your environment variables, etc. And you'll have a quick uh briefing in the tutorial I've linked in the description box below. So, once uh Python is installed, you can just open up or fire up Anaconda or Jupyter Notebook. Or you can also go with PyCharm, any of the online compilers or any of the IDE which is comfortable for you to use Python. So, I'm going with uh Jupyter Notebook here. So, we've already got the entire workbook on this particular Python tutorial. So, we'll be going stage by stage or module by module. So, let me quickly fire up a new terminal or a new notebook. And uh I'll name it as select kernel and I'll name it as uh Python basics. So, that we can execute each and every command in our modules here, you know, stage by stage. And for safe side, I've also got this uh code saved in my notebook as well, notepad as well. So, we can run them. So, let's begin with the basics. So, here I'll execute this particular one. So, Python is one of the most popular programming language for software development, AI, machine learning, all those things. And we can quickly start. You can use command these anyways. I must command them. There you go. The basics happen. So, now we will start with module one. So, here you have two sections, uh code and markdown. So, I'll enter markdown. So, wherever I have uh some module headings or titles, I'll use uh this particular section as a markdown and then we'll switch to code. So, if you are familiar with any of the basic programming languages like C or C++, then you already know you have a lot of boilerplate code. Like you might have to import the uh you know, uh studio.io input-output operations or any of the extra libraries that you need. But in this case, the syntax is really simple. Let's say I want to print something like uh welcome to Simplilearn and done. That's all. You will get the code executed. So, it's just a basic understanding of how simple the syntax of Python is. Now, we will dive into the next module. We will understand the fundamentals like data types and all those things. So, we'll quickly switch to module two. And I'll like to place the same code here. And I'll name it as data types variables. And I'll deem it as markdown and execute the code. Now, let's start with the first uh data type, which is integer. So, I'll call it as roll number is equals to 10. And the next would be uh you know, I can give uh float. Height is equals to 5.7. And the next can be a name, which could be a string type. And it would be Alice. Is student? This could be a boolean. And I'll name it as true. There you go. So, we have created a profile for a candidate. And now, let's say I want to check the data type. And it's really simple. You can just print of and the variable names. So, I've got roll number here. I've got height. And I've got name. And also a boolean value which says is student or not. Let's quickly run this cell and there you go. So, you have integer, float, string and boolean. So, just like any other programming language, Python also supports a wide variety of data types. So, these are the basic uh data types and variables that you will be coming across in Python programming. And now, let's proceed with some naming conventions. So, naming convention basic or best practices. So, try to avoid any blank spaces in variables. So, whenever you're naming a variable, try to avoid any of the blank spaces. You can take an example of student_name in place of student name. Right? So, this avoids a lot of confusion if you're dealing with the data frames or any of the real-time analytics or if any of the real-time programming situations. Now, that we have a basic understanding of the data types, variables and the best practices, we can now dive into the third module, which will be about the data structures in Python or data collections as well. And here we will be having all those uh collections, which will be the set, tuple and all those things. We can start with list. So, what is a list? So, list is an ordered set of elements or collection of elements of different data types. Or any data types as well. Unique or similar data types. For example, let's say I want to create a list of fruits and it will start with a square bracket. Remember the square bracket. So, apple, orange. Now, I want to print fruits. Now, let's understand something. So, we have four different collections here. We have list, we have a set, we have dictionary and we have a tuple. So, all of these will have similarities, but they also differ in few situations. Now, a list and a set are similar. They also are capable of storing different data types and all those things. Right? Let's say I want to include a collection of data types like name, which is a character data type or a string data type. And then I want to include the float data type, which could be 10. with decimal value. And then I want to include roll number, which could be an integer. They all store all those things. Now, how they differ is the type of execution in the end. Let's say I entered some fruit names here, apple, orange, grapes, etc. And if I want to append a new name, I can also append a new name. If I want to delete something, I can delete something. And when I print, it stores the order. Let's say I entered apple in the first place. So, apple will be coming in the first place, orange in the first place and grape in the first place. This happens in list. But when you come across set, that particular order cannot be executed. It might miss the order. It might go with orange in the first place or grapes in the first place and then comes the next, you know, the names. And when it comes to set, let's say I have a duplicated element here. Let's say I type apple for two times, apple, apple, orange, grapes. The set will not print apple twice. It will only print it once. Now, this is one peculiar difference between a set and a list. And when it comes to tuple, tuple is also same. It can also store different data types in one particular tuple, but the problem is tuple will not allow you to change anything. It is immutable. Now, this is the second difference. Both set and list are mutable, but tuple is not mutable. You might also face an interview question where an interviewer will ask you to change something in a tuple, which can be done with a little trick. So, that's how it executed using the inclusion of list inside a tuple. So, this is possible. Tuple will include a list inside itself and vice versa. A list can also include a tuple in itself. So, we'll go through all those things. Now, first we have uh created a small list with names apple, orange, and grapes, and we are able to print that particular list here. And we can also go through some uh simple operations. Let's say I want to append mango uh to this particular list. So, I can simply use it as fruits append function, and the name of the fruit that I want to add will be mango. There you go. And I'll execute this. Now, let's say I want to print fruits again. There you go. I have mango added to this particular list. And now, let's say I want to remove uh something. So, I'll simply use fruits.remove function, and uh let's say I want to remove grapes. So, I'll type down grapes, close the function, execute this, and now let's say I want to print again. There you go. So, we have successfully removed grapes. Now, this was the uh basic fundamental operation of adding or removing any element from a list. Now, let's go through another example where we try to store different types of elements. Let's say I want to go ahead with Alice example once again here. Alice is the string type, and let's say her height is 5.7 ft, and her roll number is 10, and is she a student? Yes. There you go. Close the list. And now, I want to print the items here. So, you can just casually print items, and there you go. Now, let's say I want to also uh understand the data types here. So, I can just use the same print command. Print type. And since you're using list here, so I can go ahead with items, which is the list name, and I can give the cell address. There you go. And we can also make some modifications to it. So, it's quite understandable. So, the cell address zero represents the first element in the list. One will be the second element. Second will be the third element, and third will be the fourth element. So, uh the addresses start from zero in list. And when we execute, we can understand it can also store string, float, integer, and boolean data types in one single list. So, now let me give out a single clue to you to understand list. So, it might also be an interview question for you in future. Uh they can just give you an input and say, "Identify if it is a list or tuple or a set or a dictionary." Then if you see the array or any uh data type data structure starting with a square bracket, then understand it's a list. Now, so far with our understanding, let's uh give a quick definition to list. So, I have mentioned the definitions here. Let's quickly enter them here as well. So, a list is a heterogeneous data structure, meaning it can store multiple data types, such as integers, floats, strings, and booleans within the same list. Although Python allows mixed data types, in real applications developers usually keep list contents for better uh readability and processing. Let's say in real time you're using list, then most recommended best practice is use a single data type, so that you may not face any confusions with that. Now, with that, let's move on to tuples. So, mark it down as module three. Here, the list, and now here we'll start with tuple. Now, let's start with the second data structure here, which is tuple. So, to define a tuple is an ordered uh collection of elements, but it is not uh changeable or you can also term it as immutable. And it is completely similar to list, but there are some differences. If you want to add a new element to an existing tuple, you may not. And if you want to delete something from an existing tuple, you may not. And if you want to make any kind of modifications to it, you cannot. That's the difference with separates tuples from list or any other data structure in the upcoming modules. Now, so another best way to identify if it is a tuple or not is it will always start with an open bracket or parenthesis and closes with parenthesis. Now, swapping elements, inserting any elements, removing, reordering is not possible in this particular data structure, and you can also use any type of append or delete operations. Now, let's go with the same example. Let's say I want to add fruits. The only different worst thing that happens here is you can just change the type of bracket, and there you go. Now, it's a tuple. Now, let's say I want to print this particular tuple. There you go. It retains the order as well. Now, apart from that, let's say I want to add different data types inside a tuple. I can also do that, and I can also type to repeat. And I can also try to extract the data types as well. Now, remember that interview question that we discussed, changing an element inside a tuple? It is possible when you try to include a list inside the tuple. So, let's go through an example of that as well. I will take an example of the same list that we have here, or we can also create uh a new variable IQ, which is interview question, or a question is equals to let's say I try to enter some elements 1 {comma} 2 {comma} 3, and the last element will be a list. Let's say I want to enter 4 and 5 inside the list and close the bracket. Now, let's print the question, and now you have the tuple printed. Now, let's say I want to change one of the element inside this particular tuple, which is inside a list. Let's say I want to change uh 4 5 to 5 6. Now, what you can do is you can simply type down the same question here, and you can say question. Remember the cell addressing that we did here, this particular one? The same. We can try to address the elements here. So, we have the 1 2 3, right? The third element is 4 5. So, it starts from zero. I want to allocate this particular list with 3 0 is equals to let's say 6. And now, if I print this particular question, then I have 6, right? So, there you go. We have now successfully changed the element inside a tuple. Now, we can proceed with our next data type, which would be a set. Now, let's quickly go through the definition of a set. Now, so far we have understood what a tuple is and what a list is. Now, to understand set, you might have to go through the similarities that we had with list first, right? So, the only difference what separates a list and a set is the type of parenthesis we use. So, here are the bracket we use. In the list, we used a square bracket. In tuples, we use a rounded bracket. In the set, we will use a flower bracket. That's the only difference, and apart from that, if you want to include any kind of duplications inside a set, that is not possible. So, for that, let me go through an example. Let's say I want to create a new set here, and the set could be named as numbers is equals to and it starts with a flower bracket. 1 {comma} 2 {comma} 2 {comma} 3 {comma} 3. See, I'm deliberately trying to enter some uh duplicate entries here. Now, let's say I want to print numbers. So, these particular duplicate entries will be eliminated, and only the unique values will be printed inside the set. Now, I can also go through the same example that we used before, which is this one, fruits name. And if I want to print fruits, sometimes the order may exist, and sometimes the order may change. That's the difference between a list and a tuple. The orders might change here. So, you can see grapes took the first position, orange to the second, and apple to the third. And if you want to add or remove any elements to this particular fruits set, you can also do that by a simple add method. Let's say I want to add some berries. There you go. If I print fruits again, I will have the new element added. Let's say I want to remove an element, so I can also do that by just using the remove method or remove function. And let's say I want to remove apple. I can do that. And if I print fruits again, the element will be removed from the list. With that, let me also drop a quick comment here. The best way to identify a set is it always starts with a flower bracket. Now, uh set will also be capable of storing multiple data types as well. So, we'll use the same example, and here we have two different items, but it is showing one once because it is considering the integer value of one as a unique element and the float value of one as a duplicate element of one including the boolean value of true here. That's the one reason why we just get one repeated once and the name is shown once. Right? That's the reason why we have it here. But in case if you really want to find out the data types of all elements here, you can just go to a for loop and here you have the one value which is integer, name value as string, 1.5 which is the class and this particular one is called as float here. And with that now we enter into the fourth collection of data type which is dictionary in Python. So, dictionary is nothing but a key value pair. Let's say you wanted to store some elements inside a dictionary. The only difference which separates dictionary from all the other three data types is it stores the elements in a key value pair. Now let's go through the examples for that as well. Before that let me add up the definition. This is a definition. Dictionary stores data in key value pairs. A dictionary is ordered in modern Python versions. It is changeable. It stores data as key value pairs and keys must be unique. Which means you cannot use one key for different type of elements. Let's say I try to add a key name as ABC and I store some value inside it. And again I reuse the same ABC key and store a different value in it. Here what happens is Python will save the latest entry into ABC and it will remove or eliminate the previous entry. You can also go through that example, no worry. Now let's create a new dictionary as student and here I'll use name of the student. We can use the same name which is Alice. And let's say age is equals to 20. Let's add a course for Alice which would be Python. And now you can close the dictionary. Since it is key value pairs you were supposed to use colon not equals to. And we need to separate them by comma. There you go. Now let's print student. There you go. Now you can make some mild changes to this particular code segment and try to identify the data type as well. Now let's go through this particular element which is defines the dictionary as changeable. So, I'll use the same code segment and I'll try to change the name or course of Alice. Let's say I want to change the course from Python to data science. So, we have successfully changed the course name from Python to data science. And now if I print student again, the course will be changed here. Now let's say I want to add a new element to this particular dictionary. Let's say I want to add the location. So, student So, I've added a new element to this particular dictionary which is location of Alice. Now let's try to print student details and now we have the city name New York. And now let's say I want to remove an element. So, I can use simply the delete command. I can simply use the delete command and the element that I want to remove. We can remove the city which we have recently added. And then now there you go. So, city was not included in this particular code segment so that's why it did not recognize. Now let's say if I want to print student once again. There you go. City has been successfully eliminated. Now let's discuss about the duplication of keys. Let's say I try to store data or I'll name it as duplication data set. Create a dictionary and then I'll use name is equals to XYZ. Similarly, I'll try to reuse the same code segment. I'll create a duplicate entry and name it as ABC. Close the list. And now let's say I want to print. Yeah, we missed a comma. Let's say I want to print this particular dictionary. Now what happens is it will save the latest entry alone not the previous entry. Now that we are done with the data structures or collections in Python which were set, list and dictionaries and tuples, we can now dive into the string operations so we can understand string data structures in a much better way. Let's start with some most commonly asked interview questions like string slicing or string matching etc. Such type of examples will help us understand what is the basic functionality of strings and how to implement them in real life. So, we can start with string functions or strings from here. So, let's say I want to concatenate two strings. Let's say I have two strings here and I want to combine those two strings. Now let me give the string first one as first name. Remember the declaration best practices that we discussed. Right? So, we will have the underscore separating the variable names so that we don't have any blank space or you can also go with this type of you know representation. But I'd like to go with this one. So, first name let's say we will give John and second name is equals to Lana. Now let's say I want to combine this together and save it in a new variable which is full name. So, I what I could do is I'll just copy this and I'll paste this over here and then I'll use the concatenation which is the plus symbol and then we will also use double quotes to save a space there and then another concatenation symbol which is plus and I'll copy paste second name and I'll place it over here and then I can just go ahead and write the print command and copy this full name and paste it over here and you can also add a text saying the combined string result is equals to the first name or the full name. There you go. Run the code and there you go. So, you have combined string right here. Now another most commonly asked interview question is you might have to you know find the length of the string. They might give you some random text and they will ask you to find the string length of this particular thing. So, let's try that as well. So, I'll write down a text which says let's go with Python programming. This will be our string and let's imagine that this is your question and they will say find out the length of this character or length of this string. So, let's declare another variable which says length is equals to. We will save the string length in this particular variable. Now we will use the length function and we will copy paste this text here inside the length function. Now we will use the print command and we will type down length of the given string is length. There you go. The length of the string is 19. Uh similarly, you can also face another question which says convert to upper case or lower case. Right? Convert to upper or lower case. So, it's really simple. We can use the same string that we have used in the previous example. So, you can write down here and then you can directly write down the text as well which says print text in upper case from print text in lower case. So, mild functionalities will be you can copy paste this one and change this part and you can paste text right here and you can call the upper function. So, dot Since we are in lower we'll call lower function first. Lower function and close the bracket. Similarly, you can copy this and paste it over here. You can see how simple the context and syntax is in case of Python. You can just see it. You can just call it as upper and Python will automatically understand that the user wants to print some text in lower case and upper case and there is no complexity here as well. There you go. So, the text was Python programming and we have I think we have missed an O there. There you go. So, let's run the case again. Python programming in upper case and Python programming in lower case. So, so far we have converted the text into upper case and lower case and we've covered three interview questions and answers to understand the functionality of strings. Now we can go ahead and understand string slicing as well. So, let's say this is the string slicing question and they give you some text. Let's consider text is equals to learn Python with Simply Learn. This is my text. I'll enter the text in double quotes. Now I want to split a part of this text. Let's say I want to print the first 1 2 3 4 5 6 and another 6. So, let's say I want to print the first 12 characters. Right? I want to slice the string into two halves and I want to print the first 12 characters which is learn Python. So, the first five is learn. Space is the sixth what I feel and next is the sixth which is Python. Learn space Python are the first 12 characters. Now I want to print these first 12 characters. So, I can just copy this print command here and I can say the first 12 char and now here I want to make slight changes. So, here I want to make slight changes. So, I'll take the text and I'll use a double quote and I'll place a colon and then I want to count the number of characters. So, I want 12. Right? So, I'll just write down 12 and close the square bracket and close the bracket over over here again. Now, if I print this, I will have the first 12 characters. Now, let's say somebody asks you to print the rest of the string. Let's say I don't want the first n elements of the string. I just want to print the next elements of the string. You can also do that. So, the only change is you will replace the colon in the first place to the next place and the number of elements that you want to omit. I want to omit the first 12 characters here and then the rest of the characters which are with Simply Learn. I want to print them here. So, just a mild replacement of colon from left to right and then that's done. If you execute this, we have the rest of the characters which is with Simply Learn. Now, we can go with the next interview question which is can be considered as text matching or you can also consider as text replacement. So, first you need to match the text and then replace the text, right? So, both in one shot. Text matching and replacing. So, the text can be let's consider I like programming. Let's say I like programming in Java is my text. So, let's encode this inside double quotes. And now I want to replace this particular text which is Java with Python. So, it is really simple. Let us take a new text variable. This is my new text variable and here I want to use the text replace function. So, I'll just take this particular variable text and I'll paste it here and I'll call the replace function. And now I need to provide what needs to be replaced by what. So, I want to replace term Java with Python. So, I'll separate that with colon and mention the new term which is Python and there you go. And now we can just print the new text here. So, I'll copy paste the print command and then I'll just call print new text and that should be done. So, there is a small error. Okay, I did not write the spelling correctly. So, replace. There you go. Now, we have replaced term Java with Python. So, simple, right? You can just identify and then replace the text. Now, let's go with another interview question and let's say here I want to find out if a given text element is present or not. We can consider the same text here as well. So, let's say I like programming in Java. Check if a specific part of string is present. So, now this is my text, right? I like programming in let's say I'll go with not Java, I'll go with Python. So, I'll replace Java with Python. Now, I want to identify if Python is available in this particular text or not. So, this is a little bit early for conditional statement, but it's not a big deal. It's really simple. So, we will be using conditional statement again. We will be learning a lot of other conditional statements as well or loops as well. So, we will be having if, elif and else if, a lot of those, but this is a little bit early, but not too complicated. So, we will be using if text here or if condition here. If this particular element is present in the text, then we can print yes, this present this is present in the text. Else, no, it does not identify, it is not present in the text. So, we will go with a simple if condition. So, if the term Python is available, which is in text, so this is our text, right? I'll copy paste this one here. If it is available in text and colon, then print text is text is found or element is found. Else, element is not found. So, since we are printing the text form of output, we will encode this inside double quotes and then we will have L here. So, else double quotes, we will use the same print statement. Element is not found. As simple as that. Now, let's execute this. There you go. Since we have Python, we have found the element or text. If we replace this with Java and try to execute this, element is not there, so element is not found. Now, this was a most common interview question that we dealt with. Next module which is about operators in Python. So, let me name it as module four which is operators in Python. And since this is a markdown, I'll make this a less markdown and save it. Now, operators are nothing but the mathematical operators or arithmetic operators that you most commonly use in any of the programming language which could be plus, minus, division, multiplication, floor division, modulus, etc. Or even sometimes exponents in a very rare case. So, let's go through those all those examples in one shot. And most of the times you might also face this interview question where the interviewer might ask you that prepare me some function or something like that which takes the input from my end. Here we will go through an example where we give the input, but interviewer might ask you to provide a program that can take the input from the user and then execute the output. So, we'll go through all those things in one shot. So, let me declare a few variables. Let's say A is equals to 10 and B is equals to 20 or two. Let's go with two and then we can directly start with writing the print statement. So, I'll write down the print statement addition of two numbers is equals to A plus B. There you go. Now, you can just copy paste this and simply paste a couple of times and difference of two numbers is A minus B. Multiplication of two numbers is A star B. Division of two numbers is A divided by B. Floor division of two numbers is double slash and exponent of two numbers, exponent value of two numbers is just replace the star with double star and there you go. I can execute the code and you have all the outputs in one shot. There must be an error somewhere. Yeah, we missed out this one. Let's execute again. There you go. So, you have addition, difference, multiplication, floor division, exponent and all those things in one shot. Now, coming to the interview question where you might have to go with user input. So, it's really simple again. You just have to declare a couple of variables which take the input along with the input command. So, let's say I want to take two inputs. So, I'll declare num one is equals to I just want to go with a data type here as well. So, let's go with float for the safe side. I want to go with float and I want to go with the input command or input function where it takes the input from the user. So, we can give it a text message as well. Enter the first number and close the bracket. There you go. You can copy paste this same code here and paste it and again we will call it as num two. Enter the second number. So, first all good. Now, we can have a third variable that says result and you can name it as for addition. So, we can use the same codes from here as well. Instead of A plus B, we will replace that with result and close the brackets and result will have a num one plus num two. Let's execute this function. So, our first number could be 10, second number could be two and the result is there you see. Now, you can copy paste the same command or same code and try to perform some subtraction as well. So, you can just replace plus with minus and difference of two numbers. There you go. 10 two eight. Now, for division, there you go. Now, for multiplication, plus will be replaced by a star. There you go. You can also go with floor division. So, I think you already know what is a floor division. So, floor division is something where you give an odd number to an even number and it will give you just say just the remainder part without decimal values. Let's say if you have tried to divide 10 by three, the actual result will be 3.33 something like that, right? But you'll just get three here. And apart from that, you can Okay, we did not give a complete floor division, we just gave a regular division. So, let's go with 10 again and three. So, that's the value you'll just get you know, the whole number. That's like a rounded value of So, that's what the floor division is. And you can also go ahead with exponent value as well. Let's say you just replace the forward slashes with double stars and you can give exponent exponent value and run. You can give three three three cube is 27. So, that's how you go with the user input related mathematical operations in Python. And let me also give you a small assignment here. The assignment would be prepare me let's consider this as an interview question. You might face this, who knows. Prepare a small calculator that takes user input and also has an operation that asks for what kind of operation it needs needs to be done. So, let's say the user might ask give me the sum of two numbers and might give the input or if he might ask you multiplication of two numbers and give the operation as multiplication, right? That's the kind of output that we want. So, this is your assignment. Consider this and do let us know if you want the answer or do let us know if you already found the answer. You can paste that in the comment section below. Now, we will enter into the module five which will be conditional statements and you can also combine loops as well. So, this is a module five and loops. Conditional statements and loops. Since this is a markdown cell, I'll replace this to markdown and execute the cell and there you go. So, we will be having if statement and we will also have if else statement and we will also have nested if or in this condition we will call it as elif and apart from that we will go through a couple of small like for loop, while loop, etc. For loop statement, while loop and all those things. If we have missed out anything, we'll go for it on the go. So far, so good. This is our quick agenda for module five. But, so these are the common conditional statements or loops that we will be facing. But, we will also learn these in a perspective where we are trying to question something. Let's say if you want to go with if statement. We can go with theory if functions like this. You'll have a condition if this satisfies and that. But, in instead of that, the theoretical approach, we can go with a practical approach so that you can understand in a much better way. Let's say we consider an example. We have a variable which takes the input from the user which is a numerical value and if that particular numerical value is negative, then that is a negative number. If it is equals to or greater than zero, then it should be a positive number. So, you are kind of understanding how it goes, right? So, let's try that example with if condition. So, let me take an example or we can take this particular code from here and just try to paste it here and we will name it as num and we'll take integer type of input and the enter the number. This would be my condition and this would be my message to the user and now comes my condition. If number is greater than or equals to zero, basically it should be greater than zero, not equals to zero. But, in case if somebody gives zero, that could be we can go with that in an else if condition, but for now it's okay. Print the text as So, this is my condition now. Print number is positive and close this. So, since it's a text type of output, so I'll enter it in double quotes. So, we didn't mention an else condition just for the sake of understanding how an if works. Now, I'll press some number is positive. Now, we'll go with if else statement here so that we understand what happens if somebody gives me a negative input, right? So, I'll copy paste the same code and now we will proceed with an else statement here. Else, print we can use the same code as well. Number is negative, right? Let's enter and now let me enter some number as minus 19. So, the number is negative. So, that's how an if and else statement works. Now, we can proceed with another statement where you can have nested if statement or in common terms, we can also call it in terms of Python as elif statements. So, let's copy paste the same command here and paste it over here and instead of numbers, let's mark it as marks in an exam and we can go with the float data type and enter the marks. If marks are greater than equals to 90, I would say class as distinction and if marks are greater than equals to 65, I'll deem it as first class. Marks are greater than equals to 45, then we can deem as second class. Another elif, 35, then pass. And the last option where this particular loop should close or the condition statement should close is where comes the else part and here I can print fail. There you go. Now, we can quickly execute the statement. Let me give some marks which are fail. There you go. Fail. And if I execute again and if I give about 91 marks, then I got distinction. So, this is how the multiple else if statement or the nested else if statement or elif works in Python. Now, we come across the rest of the two condition statements which is a while loop and a for loop. So, let's go with for loop first and while loop next. I'll go with for loop. We need a small Let's go with list. I want to add the same fruits example and I want to enter a couple of fruits. Let's say apple, then I want to use grapes, then we can go with mango. So, these are the couple of elements which I want to have in my list and now I want to print these elements. So, for that we can directly go ahead with the print statement, but in case if I want to print them one after the other, then I need a counter variable and using that counter variable, the control flows through this particular loop one time at a time until all the elements are printed out. So, for that let me assign counter variable. So, in normal terms, we can use any counter variable. So, I let me name it as I as my counter variable. Let me comment this. I here in this code is a counter variable which basically maintains the count of the number of times the control went through the loop. Now, let me write down the for loop for this. So, for I in the list fruits, print I. There you go. So, I missed a colon here. Indentation problem, I guess. There you go. So, we have printed apple, grapes and mango. So, whenever you're writing a loop, make sure that you don't miss this particular part which is a colon and the indentation. So, if you miss the indentation and colon, sometimes the error may pop up. Now, with that let's dive into the while loop. So, you can use the same condition here. We can also make use of another example. Let's say somebody asks you a question to print five numbers using a loop statement. So, you can use while loop there. So, while loop. So, I mentioned that in a comment. Let's go with a counter variable. So, I'll mention it as count is equals to zero and while count is less than five. Again, I missed the colon there. Count and count should be, you know, it should be increasing every once it goes through a loop statement. So, equals to plus one. So, count is equals to count plus one basically. Every time a loop runs, you need to increase the value of count by one. So, zero becomes one after the first loop, then two and so on. So, I want this loop to run for five times. So, I will have five elements. So, once you execute this while loop, we have the first five elements printed here. And if you had declared some other variable to this count, then we might have got the five count from there. So, it's how it goes. Now, we have also a couple of common interview questions based on conditional loops and loop statements here as well. You can go through this. We can share this particular workbook in the comment section below. Let's say if we wanted to find out a number is even or odd, you can also do that. Let's say I want to provide a number which is odd. So, if the modulus of the number is resulting in zero, then that particular number is even. If not, it is an odd number and you can also print some couple of number. Let's say start from one to 10, then you have it here. The only thing is you need to declare the variable's range here. Let's say I wanted to print from 10 to 110 or let's say 20 and I have to change the input variables here and I'll have 10 to 20 or 19 variables or numbers resulted in this particular section right here. And let's say if you wanted to find out the largest number of three which we already done with the elif statement, you know, kind of resulted in marks, what's the output. So, here you just change that particular instance here. You can declare three different variables and it takes three different inputs and based on that, you will get the output. So, let's say I give the first number as 10, second number as 20 and the third number as 30. So, the same elif statement works here. The nested else if statement works here. If A is greater than B, then B is greater. If B is greater than A or C, something like that. So, there you go. Largest number here is 30. Now, here we have print multiplication table using a loop, right? And here you need to provide the number. Let's say I want to go with five and the five table is right in front of my eyes. And count numbers greater than 50 in a list. So, there you go. And now we have the list here and based on the any element which is greater than 50 is 55 and 60. So, we have 89 as well. So, we have three elements which are greater than 50 in this particular list. Let's say if Let's say if I add another number or two, then I run this command again and I want to find out how many number of elements are there in this list which are greater than 50, then I'll get the result as five. So, we have about 55, 60, 89, 90, and 67. The five numbers which are greater than the given number, which is 50. So, these are a couple of more interview questions we can go ahead with in the form of conditional statements and loops. So, this particular workbook will be shared with you. And apart from that, now we enter in our last module, which is object-oriented programming. So, object-oriented programming is usually the next step in Python fundamentals because it teaches you how to organize code into reusable and scalable components. So, the core components of object-oriented programming are classes and objects. And apart from that, we have encapsulation, inheritance, and polymorphism. First, let's go with classes and objects. So, a class is a blueprint for creating any object, and an object is the instance of a class. Let's consider it in this way. A class Let's go with a blueprint example. Let's say you build a very nice blueprint to create a device or a mobile phone or a computing device like a laptop or something like that. And once you have a finalized blueprint, you can create any number of devices out of it. In the same way, if you have a completely structured class for you, then you can create any number of objects out of it. So, in our case, we have a class which is student, and the object that we yield out of this class student is this one, S1, right? S1 is the first object that we're creating here, and student is the class, and S1 is the object created on the class. So, first, we're supposed to create the class first, and then if we run the object, then we have the object created, which is John, age 22. Now comes the important part, the init constructor. So, the init method is the constructor used to initialize object properties. Whenever you declare a class, and then if you want to create an object out of the class, you need something to initiate the process of building an object. So, that is the init constructor here, and let's run this code so that we have created a class and use the process and assign the object, which is Alice, age 21. Now comes the encapsulation, which is one of the fundamental pillars of object-oriented programming. Encapsulation, as the name speaks for itself, encapsulation means restricting the direct access to some variables. In Python, this is commonly done using private variables. So, here we have the bank account class, and inside the bank account class, we have the init method, deposit method, and the show balance method. So, we will be calling these methods and executing our outputs. So, let's execute this code and see the output. So, there you go. So, the initial balance was 1,000 rupees or 1,000 INR, and then we are trying to call the deposit function and add the balance to it, which is right here. Balance is equal to plus the amount. The amount was 500, and the final balance is 1,500, as you can see here. And now we come into the inheritance, which is the next pillar in object-oriented programming. Inheritance allows one class to reuse the properties of another class. And here we have two classes, which is employee class and the manager class, and then we have the developer class as well. So, here we will be using the properties of the employee class and display the employee details and their salaries. So, let's run this code and call the output. And there you go. So, the employee is Alice, and her salary is 90,000. Alice approved the leave request, and the employee was Bob, and his salary is 70,000, and Bob is writing the Python code. Basically, he's a Python developer. Now we come across polymorphism. And polymorphism allows different classes to use the same method name with different behavior. So, here you can see we have a method definition, which is named as pay, but the classes are credit card payment, PayPal payment, and UPI payment. All these three classes have the same method, which is pay, and the name of the method is also the same. But, based on the function call, the method will be initiated. Let's say I want to call payment from a specific class. So, if I call the credit card payment class, then this particular payment method will be activated or called. And if I call some PayPal class, this particular payment method will be activated, and same goes for UPI. So, let's try to call all those three in one go. There you go. So, you see certain amount was paid using credit card, certain amount was paid using PayPal, and certain amount was paid using UPI. So, this is how you can go through the object-oriented programming in Python. Now, don't worry. We will have this complete Python tutorial notebook saved for you. It's from starting to the beginning, right? This is where we started, and this is where we ended. All these code documentations and the code segments will be saved. We will download this, and we will share it with you so that you can have access to it. And this particular file will be mentioned in the description box below. So, you can download it and run it through your Jupiter notebook and follow along with us. And with that, we have come to an end of this session on Python tutorial for beginners. And with that, we have reached the end of the session on Python full course for beginners. Should you need any assistance or any other resources used in the session, like code documentations and others, please feel free to let us know in the comment section below, and our team of experts will be happy to assist you at the earliest. Until next time, thank you for watching, and stay tuned for more from Simpl
Original Description
🔥Data Science Course - https://www.simplilearn.com/in/data-science-course?utm_campaign=eCT7gZMr3e4&utm_medium=DescriptionFirstFold&utm_source=Youtube
🔥Data Analyst Masters Program (Discount Code - YTBE15) - https://www.simplilearn.com/data-analyst-masters-certification-training-course?utm_campaign=eCT7gZMr3e4&utm_medium=DescriptionFirstFold&utm_source=Youtube
🔥Partnership is with E&ICT of IIT Kanpur - Professional Certificate Course in Data Analytics and Generative AI (India Only) - https://www.simplilearn.com/iitk-professional-certificate-course-data-analytics?utm_campaign=eCT7gZMr3e4&utm_medium=DescriptionFirstFold&utm_source=Youtube
🔥IITG - Professional Certificate Program in Data Analytics and Generative AI (India Only) - https://www.simplilearn.com/iitg-generative-ai-data-analytics-program?utm_campaign=eCT7gZMr3e4&utm_medium=DescriptionFirstFold&utm_source=Youtube
This video on Python Tutorial For Beginners 2026 by Simplilearn will help you learn Python programming from beginner to advanced level and understand how to build applications using one of the most popular programming languages. The course begins with an introduction to Python and explains why it is widely used in software development, data science, automation, and artificial intelligence. You will learn the fundamentals of Python including variables, data types, operators, loops, and functions. The tutorial covers important concepts such as conditional statements, lists, tuples, dictionaries, and sets. You will understand how to write clean and efficient Python code and follow best coding practices. The course also explains file handling, error handling, and object-oriented programming concepts in Python. By the end of this Python tutorial for beginners, you will clearly understand Python programming concepts, coding techniques, and how to start building real-world projects.
Following are the topics covered in this Python Full Course 2026:
00:00:00 - Introduction to Python Programming Tutorial
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Simplilearn · Simplilearn · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Ethical Hacking Full Course 2026 | Ethical Hacking Course for Beginners | Simplilearn
Simplilearn
AWS Full Course 2026 | AWS Cloud Computing Tutorial for Beginners | AWS Training | Simplilearn
Simplilearn
Data Structures And Algorithms Full Course | Data Structures and Algorithms Tutorial | Simplilearn
Simplilearn
SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
Simplilearn
Microsoft Azure Full Course 2026 | Azure Tutorial for Beginners | Azure Training | Simplilearn
Simplilearn
Shopify Tutorial For Beginners 2026 | Shopify Course | shopify dropshipping | Simplilearn
Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
🔥Feeling Stuck? How Upskilling Can Boost Your Career! #shorts #simplilearn
Simplilearn
Growth Hacking In Marketing | Learn Growth Hacking Marketing Strategies | Simplilearn
Simplilearn
🔥Cracked 3 Job Offers with One AIML Course! | 20–30% Salary Hike #shorts #simplilearn
Simplilearn
Top 10 Must-Have Figma Plugins for UI/UX Designers in 2026 | Figma Plugins | Simplilearn
Simplilearn
Business Analytics Full Course 2026 | Business Analytics Tutorial For Beginners | Simplilearn
Simplilearn
Simplilearn Reviews | Getting future-ready with course in Artificial Intelligence | Roopam’s story
Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
Simplilearn Reviews | How David Went From Seasoned Engineer to AI Innovator #GetCertifiedGetAhead
Simplilearn
Complete Social Media Marketing Strategy for 2026 | Social Media Marketing Strategy | Simplilearn
Simplilearn
🔥Top 4 Cybersecurity Certifications You Need! #simplilearn #shorts
Simplilearn
🔥Cloud Engineer Salary in India 2026 | City-Wise Breakdown #shorts #simplilearn
Simplilearn
Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Simplilearn
Full Stack Java Developer Course | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
Social Media Marketing Full Course | Social Media Marketing Tutorial For Beginners | Simplilearn
Simplilearn
How To Create LLM Chatbot Demo 2026 | Build a LLM Chatbot From Scratch | Simplilearn
Simplilearn
Digital Supply Chain Management Certification | Supply Chain Management Course | Simplilearn
Simplilearn
AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
Simplilearn
ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
Simplilearn
Simplilearn Reviews | Integrating AI & Music | Diego's Story
Simplilearn
Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Simplilearn
SEO Full Course 2026 | SEO Tutorial for Beginners | SEO Training | SEO Explained | Simplilearn
Simplilearn
PMP Vs CAPM: Which Certification Should You Choose? | PMP Vs CAPM | Simplilearn
Simplilearn
Complete Data Analyst Roadmap 2026 | How To Become A Data Analayst In 2026 | Simplilearn
Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
🔥5 Jobs That Are Most Likely Safe from Layoffs in Today’s Market #shorts #simplilearn
Simplilearn
🔥Git vs GitHub – What's the Difference?
Simplilearn
What Goes Behind Building the Likes of Uber and Netflix? | Product Management Tutorial | Simplilearn
Simplilearn
AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
Simplilearn
Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
Product Life Cycle 2025 | Stages Of Product Life Cycle | Product Life Cycle Tutorial | Simplilearn
Simplilearn
Project Management Full Course 2026 | Project Management Tutorial | PMP Course | Simplilearn
Simplilearn
PCB Design Course 2025 | PCB Designing Explained | How To Make PCBs | Simplilearn
Simplilearn
Python Full Course 2026 | Python Data Analytics Tutorial For Beginners | Simplilearn
Simplilearn
🔥Top Product Management Skills You Need to Succeed in 2026 #shorts #simplilearn
Simplilearn
SQL For Data Analytics 2026 | Essential SQL Commands | SQL Tutorial For Beginners | Simplilearn
Simplilearn
Simplilearn Reviews | Paving Way To Success With AI & ML Course | Soumik’s Upskilling Journey
Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
Learn Snowflake In 45 Mins | Snowflake Tutorial | What Is Snowflake | Snowflake Explained
Simplilearn
🔥ML Career Tip – How to Start Learning Machine Learning in 60 Seconds! #shorts#simplilearn
Simplilearn
🔥Agile vs Waterfall in 60 Seconds #shorts #simplilearn
Simplilearn
Excel Full Course 2026 | Excel Tutorial For Beginners | Microsoft Excel Course | Simplilearn
Simplilearn
What Are AI Agents? | Types Of AI Agents | AI Agents Explained | AI Agents Tutorial | Simplilearn
Simplilearn
How To Create a Product Roadmap In 2026 | Product Roadmap | What Is Product Roadmap | Simplilearn
Simplilearn
SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
Simplilearn
🔥What Is Phishing? #shorts #simplilearn
Simplilearn
Cloud Computing Full Course 2026 | Cloud Computing Tutorial | Cloud Computing Course | Simplilearn
Simplilearn
Simplilearn Reviews | Overcoming Rejection & career plateau to finding a New Job : Bhaskar Banerji
Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
VLSI Design Course 2026 | VLSI Tutorial For Beginners | VLSI Physical Design | Simplilearn
Simplilearn
More on: ML Maths Basics
View skill →
🎓
Tutor Explanation
DeepCamp AI