Python Full Course 2026 | Python Data Analytics Tutorial For Beginners | Simplilearn

Simplilearn · Beginner ·📊 Data Analytics & Business Intelligence ·1y ago

Key Takeaways

This video provides a comprehensive introduction to Python for data analytics, covering the basics of Python programming and its applications in data analysis, including data cleaning, visualization, and machine learning. The course is designed for beginners and provides a thorough understanding of Python and its libraries, including Pandas, NumPy, and Matplotlib.

Full Transcript

Hey everyone, welcome to SimplyLearn's Python full course. Your complete guide to learning one of the most popular programming languages used in data science today. So whether you're just starting out or want to improve your skills, this course will teach you everything you need to know to use Python confidently and explore the world of data science. We'll begin with the basics. What Python is, how to install it, and how to write your first program. We'll also guide you through a clear path to data science including exploratory data analysis and practical tools like pandas rest APIs and you will also work on exciting projects like web scraping and other hands-on projects to build your skills and by the end you'll be ready to solve real data science problems and start your career with confidence. Just a quick information guys, if you are interested to master the future of technology, then the professional certificate course in generative AI and machine learning is the perfect opportunity for you. Offered in collaboration with the NIC Academy, I kur this 11 month live and interactive program provides hands-on expertise in cutting edge areas like generative AI, machine learning and tools like chat GPD 2 and even hugging face. You'll gain practical experience through 15 plus live projects, integrated labs and live master classes delivered by esteemed IT Kore faculty. So hurry up, pan and draw and find the course link in the description box below and in the pin comments. What is Python? Python is a highle object-oriented programming language developed by Guido Van Roshum in 1989 and was first released in 1991. Python is often called a batteries included language due to its comprehensive standard library. A fun fact about Python is that the name Python was actually taken from the popular BBC comedy show of that time Montipython's Flying Circus. Now let's look at the top features of Python first. So Python has a simple structure and a clearly defined syntax. This allows the learners to pick up the language quickly, so it is easy to learn and use. Python can run on different operating systems such as Windows, Linux, and Mac, making it a portable language. It enables programmers to develop the software for several competing platforms by writing a program only once. Third, Python is freely available at the official website. Since it is open source, this means that source code is also available to the public. Now, Python uses an object-oriented approach that encapsulates code within objects. Python provides a collection of libraries for various tasks such as machine learning, web development, and data analysis. And finally, in Python, you don't need to assign the data type of the variable. When you assign some value to the variable, it automatically allocates the memory to the variable at runtime. Now, with that, let's move on to the uses of Python programming. So, Python programming language is used to develop desktop applications and build web applications too. It is popularly used in the field of data science, machine learning and artificial intelligence to analyze data, build predictive models and make business decisions. Python is also widely used in game development. Now, let's see some of the popular Python frameworks and libraries. Python can be used for web development using frameworks like Zango, Flask, Pyramid and Churi. Now you can build graphical user interfaces using libraries and frameworks such as TKER or just KER. You can also use PI GTK, PIQT or PYJS or Python JavaScript. Now, Python is also used to perform machine learning tasks using libraries such as TensorFlow, PyTorch, Scikitlearn, Mattplot Lib, and Scypi. You can also perform mathematical computations using numpy and pandas. Now, let's look at the best ids that you can use to write programs in Python and perform specific tasks. So, we have Jupyter notebook, which is part of the Anaconda distribution that is widely used these days. Even for our demo in this video, we'll be using Jupyter Notebook. I'll show you in a while. Then we have the visual code editor from Microsoft. This is also one of the preferred IDEs by learners and companies. Then we also have the popular text editor called Sublime Text editor. Then we also have PyCharm followed by Python and Spider as our top idees. Now let's look at the top companies that are using Python in our day-to-day work. So we have Google, Kora, Facebook, even Netflix, Spotify, and Instagram. Now there are other top product- based, service- based and startups that also use Python programming. So what really is Python programming language? Python is an object-oriented highle programming language that supports built-in data structures and dynamic semantics. It supports multiple programming paradigms such as structured, object-oriented and functional programming. Python is often described as batteries included language because it has a comprehensive collection of standard libraries. Python supports different modules and packages which allows program modularity and code reuse. Python was developed by Guido Van Rosum and its implementation started in December 1989. Python 1.0 version was released in the year 1994. Python 2.0 came out in October 2000 while Python 3.0 was released in December 2008. Now that you have got an understanding of the Python programming language, let's now look at the top 10 reasons why you should learn Python. So at number 10, we have ease of use. One of the most common reasons to like Python is that it is quite easy to learn and code. It provides a simple syntax that improves readability and makes it easier to understand. So developers can create any desktop or machine based application using this language. Python is very versatile and is instrumental in artificial intelligence and machine learning. We will talk about this later in the session. Compared to Java or C++, it has fewer lines of codes. In the example here, we are printing a hello world program in Java. As you can see, if you have to write a program in Java, you first have to declare the class name along with its scope. Next, using curly braces, you need to pass the main method along with its arguments. And then using system.out.print print len method you can print hello world that's quite a tedious task isn't it the same task of printing hello world can be done using just one line of code in python as shown here you can write the print function and pass whatever you want to display inside the brackets and that will print the output it is so simple that is why Python is considered as a highle language and it's open source You can just download it from the website and start using it. At nine, we have active community. You need a community to learn new technology and friends are your best asset when it comes to learning a programming language. Python has large community support. It has an extensive and active community to assist engineers, developers, analysts, and data scientists with expert support in case of programming errors or issues with the software. You can just go ahead and put your queries in the community forum. The community members will address your queries in real quick time. Communities like Stack Overflow also brings many Python experts together to help learners. Python enhancement proposals or PEP is where the proposals and the improvements are announced. Also, there are a set of recommendations or core values called the Zen of Python written by Tim Peters that represents the guiding principles for Python development. Up next at 8, we have portable and extensible. Multiple cross- language operations can be performed effectively because Python is portable and extensible in nature. For example, if the users have a Python code written on Windows and they want to execute on a Mac operating system or Linux operating system or Solaris, they can easily do it without any amendment. They can also run this code on any platform flawlessly and without any interrupt. Due to its extensibility feature, you can integrate other programming languages such as Java,Net, C and C++ codes with Python. The components of other programming languages can be used with Python and thus it can be used to make a crossplatform suitable application too. So it is a really good feature that Python provides. The next reason to learn Python is testing frameworks. Python supports several built-in flawless testing tools and frameworks that help in debugging and speeding of workflows. Some of the tools and frameworks supported by Python are piest, selenium and splinter. This is the reason for which every tester tries to use Python based tools and frameworks to test any application or code or to validate it in an easier manner. Pyest is the most recommended testing framework for functional integrational and unit testing. You can run Selenium test scripts using Python programming language to automate various tasks. And Splinter is an open-source tool for testing web applications using Python. It lets you automate browser actions such as visiting URLs and interacting with their items. At number six, we have libraries and packages. Another reason why Python has become so popular in the industry these days is that it has a massive collection of libraries and packages that make your task simple and easy. It has a range of libraries, packages, frameworks, and modules for data manipulation, statistical calculation, web development, machine learning, and data science. Python programmers have developed tons of free and open-source libraries that you can use. You can find many of them via Python package index the repository of Python software. Python provides the default package called pip. Anaconda is a third party Python ecosystem. Other examples include numpy, sci and zango. Then we have scripting and automation. Python is not just a programming language. It can also be used for writing scripts for automating tasks and workflows without human intervention. The code can be written in the form of scripts and executed later. Further, it is interpreted by the machine and checked for errors at runtime. The machine is used to read and interpret the code. Once the developer checks the code, it can further run or be used several times without any interruption. This allows you to automate a set of certain tasks within a program or the same code can be used with other applications as well. At number four, we have web development. Another reason to learn Python is that it makes the web development process so much easier. It provides a wide collection of frameworks that make it easier for developers to develop web applications. Some of the examples are Zango, Flask, Pyramid, Turbo Gears, CherryPie, etc. These frameworks are written in Python which makes the code a lot faster and stable. The task which used to take hours in PHP can be finished in minutes using Python. Python is also used for web scraping. Django offers many elements of intricate programs such as template design, management panel, signing in, signing up, signing out, URL routing, etc. Once the user establishes the framework, all these features become ready to use. Flask is a microwave framework written in Python. of all the components that are part of this module, they are all ready to execute in the server context. Pinterest and LinkedIn use Flask. Pyramid offers more attributes than Flask. It will assist users with URL routing and authentication support. Turbo Gears is a highly recommended and scalable framework that supports features such as authentication, caching, identification, management of sessions, and pluggable applications. Up next at number three, we have machine learning. The growth of machine learning has been phenomenal in the last 5 years and it's rapidly changing the world around us. Python is one of the most preferred programming languages for machine learning because of its simple syntax and support for several machine learning libraries. Using different libraries and functions in Python, the system can learn and train itself from past data. Once the system is trained, it can then learn to adjust itself to new inputs. Finally, it can make predictions and perform humanlike tasks automatically. At number two, we have data science. Machine learning and data science go hand in hand. Python is robust, scalable and provides extensible visualization and graphics options. Hence, it is widely used in data science. Python has libraries such as numpy for numerical computation of data, pandas for operations to manipulate data on numerical tables and time series. It also provides simply for symbolic computation and sci for technical and scientific computations. It has another library called pyrain which is sought for python based reinforcement learning, artificial intelligence and neural network library. Scikitlearn is the machine learning library for creating classification, regression and clustering algorithms. And finally, it provides PyTorch and TensorFlow for deep learning. Finally coming to the most important and the top reason to learn Python which is career opportunities and salary. Python language provides a variety of job opportunities and promises a high growth graph with huge salary prospects. It is being used by most of the tech giants. Industry leaders using Python are Amazon, Google, Facebook, IBM, NASA, Netflix and YouTube. Next, you can see the Google trends but I have considered three programming languages Python, Java and C++. I have compared them for the past 12 months. You can see it clearly on your screens that Python has become a frontr runner in terms of popularity and web search volume. It means people are interested in Python. They want to learn it and use it in their work. You can also check for the YouTube search. There also you will find that Python programming language is the most searched language on YouTube. Now on your screens you can see the report of PPL which is popularity of programming language index. It is created by analyzing how often language tutorials are searched on Google. It is a leading indicator. The raw data comes from Google trends. The bar graph depicts that Python is the most popular and widely used programming language across the globe followed by Java then JavaScript and C. The popularity of programming language index can help you decide which language to study or which one to use in a new software project. The next graph shows the popularity of Python and Java over the years starting from 2004 till the current period which is 2020. Worldwide, Python is the most popular language. Python grew the most in the last 5 years by 19.4%. 4% and Java lost the most by minus 7.2%. Now let's talk about the different career opportunities and the job roles that you can get into if you learn Python language. First, you can become a Python developer where you will be asked to write and test codes, debug programs, and integrate applications with third party web services. Second, you can become a web developer. Here you will be responsible for writing serverside web application logic. Python web developers usually develop back-end components, connect the application with third party services and support the front-end developers by integrating their work with the Python application. You can also become a data analyst if you know Python. As a data analyst, you have to gather data from multiple sources using scripts. analyze that data, develop and implement databases and data collection systems. You can become a data scientist. As a data scientist, you need to understand the challenges in business and come up with the best solutions using modern tools and techniques to analyze, visualize, and build prediction models to make business decisions. Lastly, you can be a machine learning engineer where you can develop intelligent machines that can learn from vast volumes of data and apply knowledge without human intervention. So there's a lot of scopes if you learn Python. But before we move on, let's understand first what is Jupyter Notebook. So guys, as you can see all over here that Jupyter Notebook is a popular open-source tool that basically allows you to create and share documents which contains codes, equations, you can have visualizations also. Basically, it is used for data analysis, machine learning and scientific research which makes it a very essential tools for developers like data scientists and researchers alike. Now before installing Jupyter notebook I request you that you have Python installed in your system. So the requirement should be Python 3.6 or greater. So now let us officially navigate to the Python's website. So guys as you can see all over here. So on python.org if I click on download python. So we're going to see that all over here download python 3.125. So as I already told you that the requirement of python should be greater than 3.6. So just you can click all over here and you can see the download has started. So guys as you can see all over here that we have installed the Python. Now let us open the file. So you can see the given software is going to installed on this directory. Okay. So just click all over here. So guys as you can see all over here the Python installation of 3.125 is in progress. Let's wait for some time till it gets installed. So as you can see guys all over here that we have successfully installed our Python. Now let us open our terminal and let us check whether Python is correctly installed. So we are going to type python / version. So as you can see all over here we have successfully installed our Python. So guys that was our prerequisite. Now there are two ways to install Jupyter notebook. The first one can be pip. Okay, pip is a package manager or using Anocanda distribution. So let us see with pip first. So guys, pip is a package manager which is used to install and manage software packages libraries written in Python. So you can see all over here that the Python with version greater than 3.6 have default pip installed in them. Okay. So we can use pip command to install our Jupyter notebook. So guys as you can see all over here we have come to the official documentation of jupitter.org and it is saying that installing Jupyter lab with pip command. So what you can do guys you can just copy all over here. You can go right all over here and click on this. Now as you can see all over here it has started downloading the Jupyter lab. So guys, we are going to install our Jupyter lab with the pip command. So this is the official documentation of Jupyter notebook. Okay? And just all you have to do is copy this and type on your terminal. So as you can see all over here it has started downloading the packages which is required to download the Jupyter notebook. Let us wait for some time. Okay guys, so we have successfully completed this step. Now let us move on to our next step. So as you can see all over here. So we have installed. Okay. Then what we have to do then you can type this. We can launch the Jupyter lab with this command on the terminal. Now let us wait. So as you can see all over here guys, we have successfully installed our Jupyter notebook. So you can go all over here and just create a new notebook and you can also choose your kernel and you can start working on your Jupyter notebook. Suppose I'll show you one snippet. So 3 + 5. Let us try to run this notebook. So as you can see it is giving us the it as answer. So it is following the Python syntax and in this way we have successfully installed our Jupyter notebook using the pip command. So now as you can also see all over here you can also install Jupyter notebook with this command pip install notebook and then you can just open it. This is also an another alternative. Similarly, you can install with VA also same command and just open the VA. Now, if you are using any other operating system like Mac OS or Linux, then you can install by brew install Jupyter Lab. So, homerew will be the package manager for Mac OS and Linux. So, I hope so you are pretty clear with how to install Jupyter notebook with the pep command. Now, I have downloaded Anacondas from this official website. So as you can see all over here this is the official website of Anaconda. Okay. Now just type your email and you can just download it. So similarly as you can see after installing I'm going to launch my installer and let us click next. Okay. Let us click agree. Okay. And let us install this on the given directory. Let us wait for some time till the installation gets complete. So guys as you can see all over here we have completed our installation of Anoconda. So just click on finish and you can say we have successfully installed our Anocanda. Now let us open our Anaconda navigator. So just click on. So as you can see all over here just right click on this and our Anocanda navigator will be opened. So as you can see all over here this is our Anocanda navigator and it is loading the packages and for us to install the Jupyter notebook. So as you can see all over here just click on launch. So guys, if you click on launch, it is going to open our Jupyter notebook. So as you can see all over here, it is saying launching the Jupyter notebook and it is hosted on localhost 8889. So this is our hosted Jupyter notebook and in similarly you can create a new notebook all over here and in this way you can start working. Uh now that we have gotten all the introductions and the basics and the installations uh regarding Python aside, uh let's get right let's get down to actually creating our first script. So now the question is uh how do we actually start doing this task of creating our first Python script how do we how do we realize uh now that we've installed uh Python like uh now let's how do we start doing something so the answer to that question is that typically when you're working on Python the one of the most basic things that you can do is create a Python script and execute a script a script is essentially a sequence of commands and instructions that you for Python to run and execute to give you a certain result. So I will show you how you can create a Python script. Now there are multiple ways of creating a Python script. You can create it directly from command line which is obviously something I would not recommend because it is not convenient and easy and it's not very useful for a beginner. Another way is using a text editor such as the one I have opened right now which is the Notepad++ text editor. Now, it's very important to not get confused uh between Notepad++ and the standard Notepad that comes with your Windows uh or Wordpad for that matter. In fact, text editors such as Notepad and Wordpad um that you are more familiar with create text and files in a form that is called rich text. Now rich text is something is text that uh contains formatting and fonts which is actually a hindrance when it comes to creating actual code. So what we need is a text editor that creates or writes text in what we call as plain text. Uh plain text is obviously text which does not contain these fonts and these formattings. Uh and it only respects white spaces and indentations. those two being actually useful towards uh creating code uh unlike fonts and formatting which are only a visual thing. So, Notepad++ is obviously a text editor that creates uh plain text documents uh that is very that was actually created with programming in mind. Obviously, you can use a bunch of other text editors such as Whim and Atom and you can Google for these. There are plenty of them. So uh without any further ado, let's create our first Python script. So one of the most common, one of the most famous examples of a first program in any program for that matter, not just Python, is creating a print statement that gives us a statement saying hello world. So in in Python, this is how you would go about or this is the syntax you would use to create the statement. All right. Now where it is very important when you are saving your Python program that you use the py prefix. So so if I were to save this I can choose whatever folder I am going to choose. Yeah this folder seems fine. So now I give the file name over here as say I want to keep it as test. I need to prefix this with py and this uh tells any uh sort of interpreter or anytime we need to read the script to know that it's a python script we need to add a py otherwise it will not be treated as a python script it'll be treated as some normal document sort of a thing. So now that I have stored it as py. Uh I have created my first python script. Now uh obviously the next question is I need to see uh what happens when I execute this line when I run this script. essentially. So to see that um there are multiple ways. The first way that I will show you is a command line method which is obviously again before we get into it is not something that I will be using to teach you. It's not something I would recommend you to immediately start using. Um but for the sake of uh showing I will show you how to execute a script in command line. Well, to do this you go since I have installed Anaconda in my system and I will be using Anaconda to work in Python. What I will look for is something called the Anaconda prompt. As you can see, this is the option that I get Anaconda prompt. Uh this will essentially open you a command line under the environment of Anaconda or Python. So in this now I'm already in the folder I believe that had my script. So uh how do I call this script or how do I run this script? Well, the command is python space the name of my file which was test. Of course, the prefix is very important. So I enter test.py. If you if this was in a different folder, you would have to change your folders in command line which is again something that I might show you later. But since my file is already in the folder that I am in in my command line, I would just have to enter this command right now. So if I execute this, as you can see, it's given me an output of hello world, which is which is what I wanted. I wanted it to print this uh these two words. And of course, the command line is now waiting for the next command for me. So this is uh one of the most simple ways of or the most rudimentary ways of executing a Python script. Now another question would be well this isn't the most visually appealing or uh not the easy to read or easy to use way of um executing scripts and I would agree and that's why I'm going to introduce a another technology or a software called the IDE. So the IDE in Python or in any programming language stands for integrated development environment. It's essentially a software that not only allows us to run scripts, but it allows us to create the scripts, it allows us to debug, it allows us to see outputs, it allows us to see intermediary outputs. Uh it allows us to do a wide variety of tools and tasks and uh it comes with a bunch of robust features to enhance our Python programming experience. So let's let's see. So I will show you a an IDE called spider which comes bundled along with the Anaconda distribution that I had mentioned earlier. So if I open the Anaconda Navigator as you can see the Anaconda Navigator shows me a bunch of technologies and options and I'm looking for something called the Spider IDE which is over here. As you can see here it's a scientific Python development environment. Uh this is exactly what I'm looking for. So I am looking to launch this. So now that I've launched it, you can see out here this is what an IDE looks like. Now this looks very sophisticated and it's it's a one and any almost any IDE is a wonderful software that where you can create your code, you can debug your code, you can check the results, you can make adjustments, changes and you can do a wide variety of tasks and functions with relation to your programming. So this is the spider ID in particular and this is how it looks. Don't worry about the exact details. Just know that on this left hand pane is our current script that is open out here and out here we will get the results in this. This is what we call a console console essentially. So now that we we have already created our script in notepad++ and I want to open that script and I want to see uh how an I how it would uh the result of that script would look in an IDE. So let's just open it. So we can browse for our file and as I had uh named it test. This is the file over here. I open this and as you can see out here in the left hand pane my script has opened and the command that I had given or had written is out over here. Now if I want to run this application I press this green button and as you can see the result of my my execution essentially is over here. It's in slightly small font but as you can see over here uh it says hello world and it's wait and the next line is essentially it's it's waiting for me to do another execution of the script and then it will give me new results. So let's actually give the system new results. So now that I have printed something called hello world let's let's change what's written over here. Let's say I will perform basic maths. All right and let's actually perform the basic maths. Again, don't worry about the details, the syntax, what I'm exactly doing. These are things that we will actually cover in the in upcoming videos and modules. So, let's create a variable called A. Let's store a a number three. Let's create a variable B. Store a number five. All right. Let's create another variable C. Uh, which will store the result of what's in A and B in the addition of A and B. All right. And let's print the result or print what's in uh this variable c or what's the result of a + b. I will print a statement saying the result of the addition of three and five is all right and I will put my result over here. As you can see uh I should get the result in this pane. So let's execute this and you can see uh my first line is executed saying I will perform basic maths and the next line says the result of the addition of three and five is eight. So uh this in this script what I've done is I performed uh two print statements and I've performed a basic expression some variable assignments all of these things we will be doing later. This is what I'm what I'm essentially trying to show you is that uh idees are a very convenient way of uh not only creating the scripts but actually seeing the results and then making adjustments as well. We can com uh we can create a completely new script. We don't need to create a script from some special file or text editor. Uh I can just create a new file here and this is my new script essentially. So I can start working on this new script right over here from the get- go. So idees are very powerful. Spider IDE comes uh bundled with Anaconda. There are other IDEs such as the IDLE IDE. It stands for um indicated uh development and learning environment. So the idle uh IDE comes uh as part of the uh basic Python implementation that I had shown you in the previous video where you if you just installed a basic uh Python uh implementation, it would come along with a basic IDE known as or integrated development and learning environment. But of course since we are using Python and this is what I would recommend uh it comes with a more robust IDE called spider uh which is actually very very helpful for scientific uh and numeric applications um and was designed specifically with that in mind. Now u this is not the only way we can actually work with Python. There's another very interesting and uh a very educative method of creating Python let's say Python programs and it's something that I will be using extensively throughout this course to explain different concepts. So this technology is called or this software is called uh notebooks. Now before I get into details I will straight I will just open not a basic notebook. So the notebook that comes as part of Anaconda is called the Jupiter notebook. And when I open or when I launch the Jupyter notebook, this is what I get. Now a very important feature or a yeah a feature of notebooks is that notebooks or a web browser or a web- based application. So you it's not something that you can use if you are offline or disconnected. Basically, if you're disconnected from the internet, it is something where which for which you would need an active uh internet connection. Uh however, it is way more robust and it has very very good uh properties that allow it to be used in education or for presentations and such. So, as you can see, this is my Jupyter notebook. These are a bunch of folders. You don't need to worry about what these are right now. I will show you how to create a fresh notebook. So if you go here now you go to new and you select under notebook the Python 3 option it will open you your first notebook. As you can see um this line is essentially waiting for me to enter some sort of a command or a statement that I would give in a normal Python thing. Now if you would have noticed the diff in uh until now everything that we were doing involved us uh creating a script which was the whole series of commands and functions. So if I go back to my spider IDE as you can see like this is a whole script and this script contains multiple different uh tasks and functions that are individually uh being performed. So this is a separate print function. This is a separate addition, another separate print function. And for longer uh programs or larger programs, you like you'll have multiple different tasks being uh done. And if you were using a script, you can only see the result of something like this by executing the whole thing at once. You cannot see exactly like what is the result of just this print statement or just this. Uh it's not typically uh what an IDE is used for. And this is where notebooks come in super handy. Uh if I had to break down my previous script essentially where I first did a print statement where I said some random thing say hello. Yeah. So if I execute this particular line, you can see it gives me the result. Now I want to do what is 5 + 3? It should give me the result over here. 8. Now the next little another part of your program might be storing five and three into variables. So I can do this and I can do this. So now this line will store the variables. Now I want to do the addition of what is 5 + 3. But I want to use the variables and I want to see what's the result. As you can see a + b means 5 + 3 which is 8. And I've essentially broken down various different parts of my previous script into into its individual tasks. and I'm able to see what each part of that script does. And this is very good when it comes to making presentations or trying to teach a class. So I will personally be using notebooks a lot to explain different different concepts of um different concepts when it comes to Python and I would recommend that you get used to uh notebooks in general because uh it's an amazing way to learn Python programming or programming in general in fact and again as I had mentioned earlier notebooks are something that it's an online application. It's a web- based application. So I will have to need a active internet connection to be able to work on a notebook which could be a disadvantage if you do not have a consistent internet connection and in that case you would probably use your idees or text editor which can be used offline as well. In this video we will be introduced to the concept of variables and expressions. Let's start with expressions. Well an expression in Python is anything that results in a value. its difference or the difference between an expression and a standard statement in Python is that a statement in Python is something that results in an action or an execution of a command. There is no calculation per se or any sort of manipulation or as I said earlier calculation resulting in between two different say numbers or other objects that results in a value and this happens in the case of an expression. So for example if I were to add two numbers say 5 + 10. This is an expression which should where two objects five and 10 are being added and a result is being given to me which is 15. Now let's see an example of a statement. Well a statement could be something like a print statement. So when I ask Python to print something for me it's not calculating anything. It's not evaluating anything. It's simply performing an action that I have or a command that I have given the system which is to print whatever I have entered over here as you can see. So this is a statement. Similarly there are uh another type of statement known as assignment statements which we will learn actually right in the next section. Well let's move on to variables right now. Now earlier you might have learned about objects in Python. So objects are essentially data uh that we can work with or manipulate in Python. Now variables are a place to store these different objects. Um, usually uh it's much easier to store objects in Python instead of using the objects explicitly themselves because objects may be very comp complicated whereas variables are very simple to use and very simply uh very are named in a very simple manner so that we can use them quite often in our programs. Now it's important to note that in Python we do not have to explicitly declare or define a variable to create them. In fact, variables are created in the same statement where we assign some object to that variable. In Python, the assignment of variables happens using the assignment operator which is the equals to sign. So if I were to if I wanted to assign a number say 100 to a variable say B. Well, it would be as simple as doing this. Now anytime I want to know what is stored in B, I just have to enter B and I will get the value that is stored in it. And we can store different types of objects inside a any variable. Let's say I store I want to store this particular word in the form of a string. Now this is stored in X. And if I want to know what is an X, I can just see what is here and it's a string hello which I had stored earlier. Now it's very important that we follow certain naming rules when it comes to naming our variables in Python or else we may be thrown errors or we might get some problems in our program. So the first rule is that you cannot start your variable name with a number. So if I were to give a variable name like for num is equal to something say the same string hello this would be an illegal variable name and I would get an error when I try this. So if I were to choose num for is equal to hello. This would be perfectly fine. I won't get an error. The second rule is we are not allowed to use any non-alpha numeric characters except the underscore character while naming our variable. So for example, if I were to name my variable num_4 and I say I said random some random string, this is perfectly fine. However, if I change num_4 to num-en 4, this will throw me an error as you can see over here. Next, the third rule is that variable names are case sensitive. So if if I have a variable called num or say num. If this was one of my variables and I stored say the value 50, this is not the same as me writing num all in capitals and say storing some other value 60. These are two different variables. So it's very important that when you name your variables, you are aware of what case you are writing them in because Python variables are case sensitive. Now the final and probably one of the most important rules in Python is that you're not allowed to use what we call reserve words in Python. Now Python has a bunch of reserve words. These words essentially are performed or they are used to perform certain special functions and are used as identifiers for certain special functions in Python that we that have a special purpose like that particular word has a special purpose within the Python programming language and we cannot use them to name our variables. So a list of them as you can see over here some of them are like false deaf if uh d raise and there are like there are around 33 of them and uh sometimes some of these words are taken out sometimes there are more words added as Python gets updated now let's let's move on to a concept uh where we try to really understand what do we mean by storing data inside a variable now when I say that we are storing something inside a variable able you get an image or you get an idea in your head that this variable is like a container where we store or we put a particular object inside it. So does this mean that variables have a place in the memory? Are they also an object that is placed in the memory where we can put other objects inside of? Well, I'll show you an example where this idea is kind of disproven or where I'll show you that the idea of variable is kind of different than what we understand by storing something inside a variable. Now let's say I'm storing the same object. Uh I will take this object as some random number. Let's say 100. And I'm going to store it into two different variables. So I take x is equal to 100 over here. And in the next line I will store 100 in y as well. Now if objects were I mean if variables were objects that we placed in our system then x and y should have two different ids. But let's see what happens when I check the ID of X and the ID of Y. They should be different in case variables were their own objects. However, as you can see, the ID of X and the ID of Y are exactly the same. So, well, obviously we know that two different objects in Python cannot have the same ID. So, does this so what does this mean when it comes to the nature of a variable? Well, the the fact is that variables are not actually objects in Python. In fact, variables are more like pointers or references to the actual object. So when I said x is equal to 100 and y is equal to 100, what I'm actually telling the system is that there is this variable name called x that I want to refer or point towards the actual object that is in my memory called 100. And I do the same thing with another variable y. So I am not exactly creating a different space in my system for these variables. These variables are more like placeholders or references that point to a particular place in the memory where this object is located. And that is what happens when I do ID of X and ID of Y. It's not giving me the ID of something called X or the ID of something called Y. It's giving me the ID of 100 each time because 100 is stored in X and Y. So as you can see this is something like a visual visual representation of what I'm trying to say. And similarly if if I were to so in this example on the left as you can see I've used the uh value of 50 to explain my point. So as you can see initially x and y are pointing towards this value 50 because I have stored 50 and 50 in both x and y. Now what if I changed the object that is stored in x? Well that means x is now pointing towards this new object and I have stored this new object called hello. the string called hello as you can see here. So now X is pointing to a new object in the system and it's called hello and I haven't changed anything with respect to Y. So Y will point towards the same thing and I can also make the pointer of Y different or what I'm trying to say is I can store something else in Y. See I stored this list in Y 50 60 and 100 and when I do that now Y is pointing towards a different object in Python and X is also pointing towards something else. So what happens to this object 50? Well, now that there's no variable referring to this object 50, it becomes what we call an orphaned object. And we can actually see that when we do the ID of X, now let's go back to my example on the right where I stored X is equal to 100. So as you can see, it gives me some ID represented by this number. Now let's say I stored X, I stored something different in X, say 200. Now if I do the ID of X, it should give me a different ID because as you can see the values are different and this is because this object 200 is what is stored in X and when I do the ID of X, I'm actually getting the ID of this new object now 200. So as you can see point as you can see variables are they should be and they are treated more like references or pointers uh instead of containers for a particular object. In this video, you will be introduced to the concept of objects in Python. Now, what are objects in Python? Well, all the data that we manipulate or use in our operations in our code are represented as objects or relations between objects. So, if you want an example, two numbers that you add in your code, well, both of them are objects and they're usually numeric type objects. Similarly, if you want to store someone's name or an address of your hometown in your code, you usually store it in a form of text and that text is also an object, usually a string. Similarly, you might want to create a container of different smaller objects inside them and that big container is also a type of an object and one of those containers are called lists. Similarly, we have many different types of objects which we will be covering during the duration of this course. The following pictorial representation gives us a broad classification of different Python data types and objects. As we can see there are five broad classifications. Numeric which contains integers, complex numbers and floats. We have the dictionary data type. We have the boolean which essentially consists of objects that have only two valid values true or false. Then we have sets and we have sequence data types such as strings, lists and pupils. Every object in Python has three important properties that kind of define that particular object. They are its identity, its type and its value. The identity of an object is it can be considered as a place in the memory or its address in the memory where an object is stored. An object's identity does not change once it has been created. So for example, if I took an example of say a string called hello, I can use the id function which is this is how you use the id function to find out the id of this object and it should be uh the answer should be in the form of uh a particular long integer. So as you can see the id of hello is this integer 2 3264 766 23024. Similarly all objects in python have an identity. We have another operation with uh regarding the identity of an object is the is operator and the is operator compares the identity of two objects. So if two objects have the same identity, it should give the answer true otherwise false. Now the next property of objects is the type. Type of an object is essentially uh what defines what kind of values and operations that that object can have. So for example, a numeric DR type in Python such as an integer would allow us to do arithmetic operations and similarly string object type in Python will allow us to do concatenation operations. Much like its identity, the type of an object cannot be changed as well. Now let's see what's the type of that particular object that I had shown you above. As you can see, it should be string. Str stands for string. Similarly, if I did a type for a number, say 50, it should give me int as you can see. Now, the third property of an object in Python is its value. Now, the value is the actual data that is contained in the object. It's the thing that we use that we display that we can manipulate and that we can perform operations on. So, for example, if I were to talk about this string, the string is hello. So the value of the string is the word or the sequence of letters that spell out hello. And similarly this particular object is a numeric object with the value 50. Let's see in this in this pictorial representation I have shown you that you can assume this dish blue area as the memory of the system. Now within this memory we have objects created called 50 and hello and this list containing smaller objects called cat pen and 40. Now what I'm trying to show you here is each of these objects have a type an ID and a value. And let's see what they are. So if I wanted to see as we had already seen the type of 50. Now let's find the ID of 50. As you can see, we get this unique ID for the object 50, which is obviously not the same as the ID of the object hello above. And the value of this object is the value of 50 itself. So that was a brief introduction into objects in Python. In this video, we will cover the topics of numeric object types and type conversions in Python. Now, let's get started. Numeric object types in Python are a broad classification of objects. Plenty of common real life applications that we associate with numerals such as arithmetic operations and calculus are done in Python using numeric object data types. There are three main types of numerals or numeric data types in Python. They are integers, float and complex. Integers as the name suggests represent all integer values in Python. These can be such as 100 minus 3 to 305 and so on. Floats are used to represent numerals that contain decimal points such as 100.3, 3.9, 4.8, - 6.8 and so on. Then there is the complex object type which is used to represent complex numbers in Python. And this is an example of a complex number 3 + 7 J. This is a complex number 3 + 7 J where the real component is 3 and the imaginary component is 7. All complex numbers have a real and an imaginary component. And this is how we denote them. Now it's important to note that this J is a very common symbol in maths and engineering used to denote the imi imaginary portion of a complex number. And it's the same in Python as well. So moving on, let's talk about type conversion in Python. Type conversion refers to the conversion of an object from one data type to another. For example, from string to an integer. And there are different types of conversions. And let's go through some of them. First of all, let's consider the conversion of something to an integer. And more specifically, let's consider the example where we convert a string to an integer. So let's consider my example string to be some something called 145. And I'm storing this within a string for a reason because I want to convert a string to an integer. So as you can see, I have stored this 145 within my uh within a variable x. And if I were to confirm that is actually an integer, I can use the type function and see that it is actually an integer str. Now let's convert this into an integer using the int function. So how would we use it is simply passing the int uh simp by passing the variable that we want to convert into the int function. And as you can see this is what I've done over here. But before this I will also store it into another variable. All right. Now let's see what's in y. Well, y gives us 1 145. But are we sure that it's an int? We can just check it by using the type function. And as you can see, the type gives us uh the answer int. That means that we've converted the string to an int. Interestingly, we can convert something and also specify what base we have to treat the number as. By default, when we pass something in the int function, the program or Python will treat whatever we have passed uh within the string as something in base of decimal. But what if we were to pass something that is well not in a decimal? Well, we could do it like this. Now, let's store y and in y let's store let's do this and I will show you what this means. X and I will give a comma and 8. What this tells Python is well I want to convert the string in X into an integer but I want to treat whatever is in X as a number of base 8. So 145 is actually 145 in the base 8. Now when we see what's in Y we get 101 which is different to 145 because well 101 is actually the decimal equivalent of 145 in the base 8. Similarly, if we were to give it in the base two, we would just replace 8 with two over here. Now, next, let's talk about converting something to a float. Now, as we know, float is just simply something that has a decimal point. So, let's convert an integer into a float. How would we do that? Simply by using the float function. So, if I give 120 and I pass this integer through the float function, I should get 120.0. These two are not the same though they may mean the same things to us but in for Python 120 is an integer and 120.0 is a different object which is a float and this is how we convert something to a float. Now what if we wanted to convert an integer to a string? Well, we can use the str function. We can also use the hex and the o function if we want to convert a particular number to a hexadimal or an octal string respectively. Let's look at all three examples. Say I have a number 688 and I want to convert this into a string. I just use the str function around this. So as we know just to confirm let's see what the type of 688 is. This is this should be an int as we can see. But when we pass when we let's say uh we convert it into a string 688 and let's store it into some variable let's call it a. All right. Now let's see what's an A. It gives a 688 in the form of a string. But we can confirm by checking the type of A. It is an S str. So it is a string. Similarly, we can use hex if we wanted to convert an integer into its hexadesimal equivalent in the in in in as an output of a string. As you can see this comp this sort of this sort of complicated thing is actually telling us that we have converted 688 in terms of hexa decimals. Now how do we read this output? This zero should not be treated as anything. It's more like an identifier which says that the letter after this first zero is the base of this whole number. So it's saying that x stands for hexadimal. So it's saying that 2B 0 is to be treated as a hexadimal number. And if you did basic maths uh you would find that the decimal equivalent of 2b 0 is 688. Similarly if I did oct if I use the oct function for 688 it will give me the result something like this. So again how to read this? The first zero is to be treated as an identifier and not part of the number. What it's saying is the letter after the first or after this zero is the base of the number following these two uh following these two characters. So as you can see as you can see what's this saying is that this whole number is an oct represented by this letter O and the number itself that we are dealing with is 1260 and 1260 in octal system is the equivalent of 688 in the decimal system. So this is how we've converted a an integer in uh an integer into a hexadimal or a an octal string. Now what if we wanted to convert two uh numeric objects into a complex data object? Well for that we can use the complex function. As you can see here if I passed complex five and say um say something like 3.1. Let's see what this gives us. As you can see, it gives us an uh a complex object where our real part is five and our imaginary part is 3.1. So what this does is essentially uh you pass two numbers. The first one is the real component and the second is the uh imaginary component. It combines to give you a complex number as you can see here. Now let's look at some other type conversions. The next type we will be talking about is converting something to a pupil or a set or a list. So what if I wanted to convert a string into a pupil. I will use the pupil function and uh as you can see over here. So let's say I have a string called random. Let's call it random. All right. Now if I want to convert this to a pupil, I will use the pupil function. As you can see over here, the output will give me pupils where each individual component of this pupil are the individual components or the individual characters of my string random. Similarly, if I wanted to convert the string to a list, I would use the list function and this will give me a list of the individual characters of the word or the the string random. And I could do the same thing with the set function to create a set of individual characters of uh the string random as you can see here. So yeah, these were some of the basic Python uh type conversions that I have shown you. As we learn about more complex data types and different object types in Python, we will learn different uh type conversions and functions associated with them. In this video, you will be introduced to the concept of strings. Strings are an object type in Python used to store textual data. This textual data could be something like, for example, someone's name. It could be an address of a place or it could be something like a word or a sentence. Now, strings in Python are an object type that is actually a subtype of a broader classification of objects called sequences. Sequences are objects in Python which contain components placed one after the other where each component is given what we call an index a numeric index. This numeric index identifies the component in the sequence and is positioned within the sequence. Now since Python is a zero index based language the first object of any sequence is always index zero. The second is index one. The third is index two and so on. Now let's move on to defining strings. How do we define them? Well, strings are defined using what we call delimiters. And delimiters occur in pairs, an opening and a closing delimiter. In Python, these delimiters are pairs of single or double quotes. So, for example, if I were to use single quotes to define a string, I could I would do it like this. This is a string. As you can see, this is a string is printed over here. This is delimited using single quotes. Similarly, if I were to define a string using double quotes, it's as simple as doing this. This is also a as you can see. Now, a valid question arises. What if I wanted to include a single quote within my string? Well, if I try to let's see what happens if I try to print a statement with a single quote naturally inside it. So say I'm saying it's my birthday. All right. Let's see what happens if I try to print this statement. It says an invalid syntax. And this is because as I had mentioned in Python, single quotes and double quotes are delimiters. So they have a special function in Python and we cannot simply just use them within a string because Python will treat them specially for a special purpose. So what Python will do is it will pair this and this delimiter single quotes and say okay this looks like a string to me and it's not going to understand the rest of this and then it'll find a random single quote and it won't find its pair and it will basically throw us an error because of this. So one way or one workar around to introduce single quotes into a string is simply to delimit our string itself using the other type of delimiter or double quotes. So if I want to include a single code, I will close my string using double quotes. So if I did this instead of what I had done earlier, this is a perfectly valid and legal way of defining my string. And I could I would do the opposite. If I had to introduce say double quotes within my string, I would use single quotes to close it. So if I were to write a speech statement, she said I am hungry. All right, I have I want these two double quotes to essentially show that this is a speech and I'm going to close the string using single quotes and this is a valid way of doing it. As you can see, my string has these two double quotes. Now I had mentioned that strings are sequences. Well, let's describe how are they sequences. So, first of all, all sequences in Python are a um it's a essentially a sequence of smaller objects that form the sequence, right? So, let's try to understand like how do how are strings to be treated as sequences. Some sequences that we will learn later are like lists or pupils. And in all sequences we can retrieve any particular object or component in that sequence using its index. And how do we use indexes in Python? Well, we enclose a numeric index within square brackets. Now let's see what I'm trying to talk about by this example. Now say I'm storing a particular string called say random within. Now my variable name here is test and I'm storing the string random within it. All right. And this is a way of retrieving a particular uh index from test. I write the variable name and then next to it I put the square brackets. Now I'm supposed to put um a numeral within the square brackets to uh tell Python like what particular index I'm looking for. So let's try zero. Now as I said Python is zero index based language. So the zero index essentially means the first part of or the first component of a sequence. So let's see what happens when I ask Python to retrieve the first part of uh what is stored in test. It gives me the string R. In fact, it's just one character R and it's a string. So as you can see, it has given me the first character of the string random which is R. So what this shows is that this string random is essentially a collection or a sequence of one character strings. So this is so random is essentially a collection of the string r the string a the string n and so on together combined to form the whole string that we call random. Similarly if I wanted the character at the third position of this thing I would use well since it's the third position and since we're working in python I would use the index 2 and it should give me the letter n. As you can see it's given me the letter n. So this is how we can show that uh strings are also sequences in Python. Well, now let's move on to um certain string operations and functions that we can perform. Well, as you have seen already that we can retrieve any particular character within a um within a string using numeric indexes. Well, what if we wanted to know what index is a particular character at? And we can do it like this. We use the index function. So let's say my test and I want to know where or what position the character D is in my string random. So this is how I would use the index function index and within the index say I'm looking for the character D and now I it should give me the answer 0 1 2 it should give me the answer three. So if I execute this it gives me the index three. So this is uh the index function that we can use for our strings. Now what if we want to um say slice a string into a into its uh into a smaller part. We want to slice it and we want to retrieve only that particular slice. Well, here is an example. Say I'm going to I'm going to use the same string called random and it's stored in test. Right? So let's so one way of uh so the way of doing this is like this. Now let's see what this let's just see what this does first. As you can see, it's given me a and d. And if I went to my string random, a and d is this particular slice. Now, let's try to understand what I have done by entering 1 colon 4. Well, what this has done is it's retrieved a slice from the first position uh the first index which is the character a up until the fourth position which is the character O. But it has not included O. So it's very important when I index like this every every time I put something to the right of this colon I am not including this itself. All right. So it's essentially one when I say one colon for what I'm telling Python is give me the first the second and the third character but not the fourth one. So it's given me a n and d and it's that's this is how we do a slicing operation in python. Similarly, if I were to say slice from the first, if I wanted only the first and the second character, I would do this is what I would do. If I wanted the first and the second character, I would do 1 2 3. So this way it tells Python that I want the first, I want the second, but not the third of. So as you can see, I get a and n. Now, so this is a basic slicing. What if I wanted the portion of a string from a particular point all the way to the right or all the way to the left? Well, let's consider the example of where I want the portion of the string random from the say fourth character until the left. Well, the way I would do this is test. Now, since I want it all the way to the left, I don't enter any index to the left of my colon sign. And since I want everything to the left of the fourth character, I enter four here. So as you can see, it gives me a r a n and d, which is everything from the fourth character of my string random to the left. Similarly, if I wanted something to the right of it, I would just do it like this. I would enter some index here and I would leave the portion to the right of the colon blank. So this will give me everything including the third character since this is how we treat the uh indexing in Python. Everything including the third character all the way to the right. So this is Dom as you can see. Now another perfectly valid um slicing is say I want to slice or take out uh different characters from the string but I want to skip certain characters like I want this one then I want to skip one and I want to take the next one and then I want to skip one. Well in that case we have to introduce a step. So one way of doing this is now how do we read this? So as you can see I have written 0 col 6 col 2. So what this is telling Python is I want every character from my string test uh starting from the zero character up until the sixth but not including the sixth after skipping or taking two at a time. Taking two at a time can also be assumed as uh skipping one at each step or skipping one character at each step. So what this will do is it will go to random. It will take zero one. It'll take r and then it will skip the next one. So it will not consider A and then it will pick N and then it will not consider D and then it will consider O up until the sixth character whichever that may whichever that may be. And if you see the output it gives us R N O which is exactly what we wanted. We wanted R we wanted N we wanted O where we skipped uh A and D or we skipped the every second character essentially. So this is a way of um slicing strings while also skipping certain characters or skipping characters in steps. Now Python is also an uh there's another interesting technique that we can use in Python to uh where we can start retrieving characters from the rightmost side of uh a sequence or a string. Uh we can use negative indexes. So if I were to for example show you let's see what this what this gives me. test what what is a minus1 index? It gives me the character m. Now remember a string is random. So minus1 gave us the last character of the string random which was m. So this is a way of using negative indexes. And similarly if I used test minus2 it would give me the second last character which should be the character o as you can see here. Now there are some other important functions that uh you may use in python. So for that let's create another let's create another string. Let's call it upper lower. All right. Now I'm storing it again in the same variable test. Uh let's see what happens when I use the upper function and what happens when I use the lower function. Now I'm going to use the lower function for this. So these two functions will respectively give or give us the result or give us our string in uppercase and lower case respectively. So as you can see the upper function created the first string in full uppercase and the second one created this the string in full lower case. Now another important and probably one of the most important methods that we use for strings especially when it comes to data science is the split function. So let's see what I mean by split function. Let me create another string. Let's call it hello world. All right. And I'm going to use a split function and I'm going to see what happens when I use this function essentially. So what I'm doing in these in this these three lines is I'm creating the string hello world. I am storing it in test and then I am using the split function on the test and whatever result I get I'm storing another variable called sliced and then I'm just going to show you what is in sliced. As you can see, what's happened to the string hello world is that I have broken it into its components or its component words, if that makes any sense, into hello and world and I've stored both of these into what we call a list. Now, you might ask, well, how does Python know that it has to separate at a blank space? Well, the split function by default will break up a string at its blank spaces. But if we wanted, we could break it up using or at every comma. So for example if I wrote hello world using comma and if I put a comma inside over here and now if I try to execute this like for example I am going to find I'm going to look for commas in the string and then I'm going to try to split it. As you can see there's no splitting happening. I have one list with my original string itself because it's not found a comma. What if I introduced a comma over here? Now let's see what happens. As you can see the splitting has happened. And it's found this comma and it's caused a split between hello and world. Similarly, if I in my string, if I put a comma again and I put something else, it should give me the split over there again. So, we can define our split using some whatever we put in between these uh circle brackets after the split function. It's just important to note that by default if in case we do not enter anything over here, it will use blank spaces to do the splitting. uh another very important operation and very common operation in strings is what we call concatenation. So if I have two strings first and say another string second and I want to join these together. Well the operator I would use to do this is called the plus symbol. This is the concatenating operator when it comes to strings. So what is the result of this? Let's see. Let's print this out. Let's print this whole thing and let's see what is the result. As you can see what uh this has done is it has combined the f string first and the string second into one string called first second. So this is the concatenate concatenation operator. Now finally uh the last topic in this lesson is the topic of escape sequences. Now escape sequences are special commands that tell Python to either suppress special meaning of some character or symbol in a string or give or give the special or give some special meaning to an otherwise ordinary character um in a string. So let's look at the first example. Now remember my in my for earlier in this video where I was I was telling you like uh what what is the way of writing or how do we introduce single quotes or double quotes into a string and I had told you the trick if I want to use a single quote in my string uh I just close it using double quotes or if I want to use a double quote I close it using single. Well another way of doing this is using what we call an escape sequence and an escape sequence in Python is the backslash character. All right. So let's see what happens when I use the backslash character where I want to introduce my single quote. So if I use my previous example where I wanted to introduce a single quote and say uh I'm going to close it using single quotes as uh as well. So I'm going to go back to my error example so as to speak. Now this would throw me an error right? As you can see it has thrown me an error. So what if I used the escape sequence that I mentioned the escape sequence is just back slash character. Now this is the point of the string where I want my my single quote. So I introduce a backslash. Now I have my single quote and I continue writing the rest of my statement. Let's close the string. Now will this work? As you can see this has worked. So what this has done is this backslash character has told Python to not treat this uh special character or the single quote to not treat it specially and let it be as a part of the string. So as you can see that's what's happened here. Now the next case or the other uh use case of escape sequences is when we want to give a particular character that is otherwise just ordinary some special meaning. So um let's take the example of the character T and the character N. We use the character T to introduce tab space. Um and we use the character N to introduce what we call line break. Well let's see by an example. So normally the character T has no special function. So the character t within a string will just uh be outputed as the character t itself. However, as you can see here, I'm going to introduce a backslash before this character t. Let's see what it does. It introduces this thing that we called a tab space, which is the larger than normal space. Similarly, if I were to use the uh back slashn combination, this would introduce what we call a line break. And if you were to see the output of this, you can see at the point of the string where I have this combination of back slashn, a line break has occurred. So, uh there are plenty of other escape sequences that you may choose to learn. And u these are just two of the probably the most common ones that are used. In this video, I will give you an introduction into lists and pupils. Starting off with lists. Lists are a collection of ordered or bit arbitrary objects that are similar to what we call an array in other programming languages. But lists are way more flexible when it comes to Python. Python lists are a type of sequence. And we might have you might have seen what a sequence is when we were learning about strings. And much like in sequences or any other sequence, list objects are assigned a numerical index. And whenever we want to manipulate an object in a list, we use its respective index. How do we define lists? The lists are defined using square brackets. So this is a simple way or a simple list that I have just created and assigned to a variable A which contains three objects 1 2 and three. Let's talk about some of the features of Python lists. Python lists are ordered. And what this means is that even if two lists contain the exact same elements, if they if the elements are placed in a different order, the two lists are actually unique and different. And I can check that over here. I have created a list 1 2 and three. And say if I create another list two and one and three, the same elements but in different order. I will use the is function to check whether these two lists are the same. And if they are the same when I use is function it should give me the value or the answer true. And if they're not the same it should give me the value false. And as you can see I get the value false because even though I have two lists with the same elements they are in different orders and so they are different. And that's what we mean by lists are ordered. The next property for lists are that they can be manipulated using their indexes or the elements and the objects inside a list can be manipulated using the indexes and we will see that in the section where I show you list operations. The next property is lists are mutable. What this means is that once we create a list object, we can actually make changes and modify them without having to create a new list object. The next property is that lists are dynamic. And what this means is that as we are making or as we are programming, we can actually make changes to an already created list as we are programming without having to go through a compilation stage. So if we had to say increase the or we had to add certain elements to an already created list, that original list grows in size to accommodate for these new elements. The next property is that lists can uh contain any arbitrary objects. So if I created a list right now where say if I want to store some numbers say some floatingoint numbers now and I can put strings as well into my list. All of these are valid uh when it comes to objects that can be put inside a list. We have no such restrictions. So we can put any arbitrary objects inside our list. The final property that I want to talk about is that lists are uh they can be nested to any arbitrary depth. What this means is that I can put a list within a list and I can keep nesting it essentially by putting as many lists I want within my list and I'm only essentially restricted by my systems memory. So if I created a list like this and within this say I put another list and within this list I put another list I can keep going on to by keep going on doing this and I'm only restricted by the memory of my system that I'm using. So moving on let's move on and talk about some important list operations that we will be doing when it comes to lists. So let's create a basic list called a where I'm storing six numbers. So now say if I wanted to retrieve a particular element, say if I wanted to find out what's on the index three, this is how I would do it. If I wanted a slice of my original list, and much like strings, I do it the same way. So what this does is it tells Python that I want all the elements of list A from index one to index 4, but not including index 4. So it'll give me 1, two, and three index uh objects. So it should give me 2, three and four in this case. As you can see here 2, three and four. I can do the same thing by considering elements say two at a time. If I wanted to consider elements or consider every second element, what I would do is this syntax I would use this syntax. And when I give this command to Python, what it tells what it understands is I want every element from a from index one to index 4 but not including index 4. But I am going to consider two uh every second uh uh element essentially. So what it will do is it will go here and then it will skip one and then go here and then skip one and that's essentially what we uh what it's essentially what we call slicing by using strides. So I'm taking strides. I'm not considering elements consecutively, but I'm skipping certain elements in between. If I wanted to consider every third element, I would change this to three. Fourth element, I would change this to four. All right? So let's see what happens when I take every second element, it should give it should give me uh it will consider say from one to index three, right? So it should consider essentially this section. But since it's going to skip one, it's going to consider this, skip this, and then consider this. It should give me two and four. As you can see, it has given me two and four. And like in other uh sequences, we can use negative indexes as well. Negative indexing essentially starts looking from the right hand side of the list. So when I say a minus one, it's essentially looking at the last element of the list. So it gives me the sixth or the last element which is the which is the object six. If I did a minus 2, it gives me the second last element. Similarly, another neat trick that we can use for sequences is the following syntax. Double colon and we give a minus one. What this tells the what this tells the system is I want the list A but with all the elements reversed. So as you can see I get my element my list A but the elements have been reversed. Right now let's move on to uh concatenation and replication. Well, concatenation much like in strings is done by using the plus sign. So as we know on either side of the plus sign should be two similar objects. So if I'm doing a plus something a being a list on the other side it should be a list as well. So let's add a list like this. Now let's see what's in a as you can see my original list has 7 8 9 added to it. And I can also add things to the beginning of a list similarly. So if I wanted to add say zero, you know, at the beginning of a list, I just do it like this and I get the element zero added to it. It's very important to note that I I I actually added zero within a list because if I did zero like this, it would throw me an error because like this zero is just an int object and it's not a list. But when I put the square brackets, I make it a list and then this concatenation becomes valid because a is also a list. Similarly, if I did a star 2, this is essentially replication or a replication function where I'm repeating the values in a twice. If I did a start three, it's the same function but now I'll have the elements repeated thrice as you can see here. Let's move on to modifying list values. uh this also shows the mutable property of lists that I had mentioned earlier. So let's consider this example. So I created a list with elements where there's the three strings eggs, apples and carrots and I have uh five int objects 1 2 3 4 and five. Now if I wanted to change say the first element all I have to do is take the zero with index and say if I want to replace eggs with say mango this is how I would do it. Now I've replaced eggs with mango. If I check what's in B you can see the eggs have been replaced with the element mango. Similarly I can use the slice syntax to replace uh a particular slice from my list with uh a slice essentially. So let's look at this. Um I'm replacing I want to replace the first three elements. I want to replace mango. I want to replace apple and carrot. So what I will do is I will consider this since this carrot is the second index. So I will consider 0 to three because third is not counted. Now I'm going to replace this with three different um let's see kv and say sponge. Now let's check what's in V. You can see my three elements have been replaced. In fact, I don't have to replace like for like. If I want to replace say three elements with only one or two elements, that is also possible. So now if I want to replace the first three elements, orange and sponge with um just one element. This is how I'll do it. Let's say wine. Now let's check what's here. As you can see, three elements have been replaced with one wine. I can do it vice versa as well. I can replace smaller number of elements with a larger number of elements. But here there is a slight caveat that I want to show you. So an obvious way of doing this would be say if I wanted to replace the first element wine with three different elements. An obvious way would be just consider that that element's index and then put whatever objects you want. Say I want to add instead of wine I want to add beer. I want to add ball and say club. Yeah. Well, let's see what happens. Now, if I say B, check what's inside my Now, you can see my elements have been added, but they seem to have been added as is. You know, uh I had entered a list over here and that whole list has been replaced uh or this wine has been replaced by this whole list in the first position. But that's not exactly what I wanted. I wanted the elements within this list to be individually placed into my list. And the way to do that is not this syntax but actually what I'm going to show you now. If I want to replace one, if I want to replace the index or the object at index zero, I would give this statement a slice statement where I will give 0 colon 1. So when I do this and if I um so let's create my old scenario again where I had one and I had 1 2 3 4 and 5. Now if I do this B 0 but I give a slice and this slice is essentially a single object slice it's essentially the zero index again but because of this uh formatting or this this type of syntax that I'm using what Python will do is now when I say beer and ball and club now what Python will do is it will not consider this whole list and add it to in place of uh wine or whatever I want to replace it will actually consider the elements inside of this individually and then replace. So if you see here now if you see my list I actually have the uh I've removed wine and in place of it I've put beer ball and club but these three are actually individual objects within my list and not objects within a list that is then placed within my original list. So this is an important caveat that uh you should take note of. So moving on, let's talk about certain methods associated to lists. Let's take a simple list. Now 1 2 and three. The first operation that I want to show you or the first method is the append method. So when I do a append and say if I want to append the list by one object called four. I just do it like this. Now let's see what's a I put. So as you can see the append has put the object four into my original list. Now say if I wanted to append three different objects. I want to append five, six and seven. Now let's see what append function does. Oh no. As you can see, it's done a similar operation to what we have seen earlier when we gave a single index or this single element replacement uh that we saw earlier. It essentially put this whole list into this particular spot into the list. And this is not what I wanted. I wanted five, six and seven to be individually placed. And we do have a way of doing that. And the way to do that is the extend function. That is what I'll show you next. Now if I want to extend say the original list by three different elements 8 9 10. When I use the extend function, it will not put this whole thing. It will consider each object inside this thing individually and then add it to a. So if you see my result, this is exactly what I wanted. Now the next method that I want to discuss is the remove method. So the remove method is uh what you how you use it is within the parenthesis you put the object that is present in the list that you want removed. So you don't give an index over here. You give the object itself. So if I want the object 8 all right this number. If I want 8 itself removed what I will do is put the value 8 here and it will remove it from my list. So if I check my list A, as you can see the value 8 has uh it's gone. Our next another similar function to remove is the pop function. Now the pop function by default will remove the rightmost value from the list. But unlike remove the pop function actually outputs a value uh and that value is what we have popped out of the list. So by default it will pop out the right route rightmost value of a list or rightmost element of a list and in this case that element is 10. So it should give me 10. But of course if we want to pop out any particular object in this case we do not give that particular object we give its index. So now say if I want to remove this uh this list object from my bigger list. Um as I can see it's in index 0 1 2 3 4th it's the fourth index. So if I want to remove the list which is at the fourth index I give the index value inside the parenthesis and it pops that out for me as you can see over here. So this was it for lists. Let's move on to pupils next. So pupils are another ordered collection of objects much like lists but they differ from lists in two key properties. First of all uh pupils are defined using parentheses instead of square brackets. So this is how I would define a pupil with elements 1 2 and three. And the next very important property that is different or that uh differentiates pupils from lists is that pupils are immutable. And what this means is that once we create an object of type pupil, we cannot make any modifications to it. We would have to only create a new object if we wanted something different. And this is obviously a key difference between a pupil and a list. But apart from this uh every operation that we have done on lists are actually possible to do in the case of pupils as well. So any operation that we did to lists that did not modify the lists or that does not do any modification we can actually apply to pupils as well. So if I wanted the first element of this dupal all I have to do is call it by the index zero. It should give me the value one. As you can see if I wanted a slice I can do that as well. It should give me two and three. And if I wanted to reverse my pupil, well, I can use my same neat technique that I've used for lists and that I can use for sequence, I mean strings as well. So it gives me my old pupil but with the elements reversed. So now the natural question is why do we use pupils over lists? Well, one important difference is that when we when we make a program execution where or where we are manipulating a pupil, if we did the same thing for the exact same objects in uh that if if it were present in a list, uh it would be much faster in a pupil. Essentially, program execution is just faster on pupils when compared to an identical list. So use tupils over list when we want to be efficient while we're creating an ordered list of objects. So whenever we create an ob order ordered list of objects that we don't need to or we don't want to make any further modifications to we don't need to create a list we can create a pupil. And another very important area where we use pupils over list or why we need a pupil instead of a list is uh when we are using dictionaries. dictionaries as we will see later is a data type in Python that needs an immutable component uh while we are creating the dictionary. So if we want to use uh something that is like a list but since lists are mutable we can use a pupil instead and use that when we are creating our dictionary and we will see like what uh what I mean by uh the the immutable component for a dictionary when we actually uh learn about dictionaries but yeah these are some of the places where we would use a pupil over a list. uh a brief section on pupil unpacking and packing is what I would be doing right now. And what that means is that when I create when I give this sort of a statement you can assume this to be me packing this pupil into a object or a variable t. Now what's very interesting is and this is something that's very key to pupils is that I can unpack a pupil onto another pupil. So let me show you what I mean by that. So now that I have packed 1 2 3 and four pupil into T. Let's unpack it into another pupil. Let's call this let's uh put these elements into this pupil and I put this into T. All right. Now let's see what I mean by unpacking something onto something. Let's see what's the what what what happens when I put A. If I just want to see what's in A, it actually gives me the value one. If I see what's in B, it gives me the value two. If I see what's in three, give me value three and D gives me value four. So essentially if you think of it what I have done is I have matched this pupil then put it into t and then put that pupil t into this pupil a b and c d. So what it's what what has happened essentially is the element A has been um or a better way to say this would be the element one has been packed onto or unpacked onto A. Two has been unpacked onto B. Three has been unpacked onto C. Four has been unpacked onto D. To show you what I've done in a single line is essentially this. This is essentially what I've done. I have assigned one to a, two to b, three to c, four to d. I have matched these two pupils together like this. And this is a very neat feature of uh pupils. The only only uh important thing that you have to keep in mind is the elements of this pupil and the elements of this pupil should be equal. So if there are four elements here, there should be four elements here. All right. And in fact another very important thing about or a neat feature is that we don't really need to mention the parenthesis when we're doing this uh unpacking or packing. So if I did x comma y comma z if I did it like this if I put say five and six and seven this is also a valid way of packing and unpacking. So now if I see what's the value in x it is actually five. If I see what's the value in y it is six. If I see what is the value of X and Z, it should give me a pupil containing five and seven as you can see over here. So this is a neat feature of pupils called packing and unpacking. In this video, we will cover concepts surrounding dictionaries. Dictionaries are another type of composite data type in Python that are also a collection of objects much like pupils and lists. And like lists, they are also mutable, dynamic, and can be nested. However, a key difference and property of dictionaries is that they are unordered. Items in dictionaries are paired using keys unlike in list and pupils where the objects are assigned numerical indexes. To define a dictionary, we use curly braces. Each key value pair in this dictionary in a dictionary is separated using commas and the key and values themselves in a pair are separated using a colon. Let's look at an example. This is a dictionary where I have three key value pairs. As you can see, they have been separated by colons and each of the pair themselves are separated by commas and these are enclosed in curly braces to define the whole dictionary. In this uh example, these are the keys banana, apple and grape and their respective values are yellow, red and green. So this is very important that in this particular uh data type we have what we call a key and that key is assigned a value and we can have multiple such pairings and we have three such pairs in this particular example. Another example or the or another type of way to define a dictionary is using the dict function. This is how we use it. As you can see I have inputed two value or two object pupils. This is a pupil. This is a pupil. And this is a pupil. And when I use it in a dict function, uh when I place it within a list, what Python will do is it will consider the first element of each pupil as a key. And the second element of each pupil as its respective value. Now if I check what's in D, as you can see, the key banana has a value yellow, the key apple has a value red, the key grape has a value green. So this is another way of defining dictionaries. An important note over here is that the the objects that we use for keys have to be of an immutable data type. So we cannot use for example lists uh as an example of keys. But we can use say integers or strings for our dictionary keys. Also keys have to be unique when it comes to a dictionary. You cannot have two different keys with uh or should I say the same key having two different values. You can have only one key and that one key will have a unique value assigned to it. Duplicate keys are not allowed. However, when we speak about values, we have no such restrictions. You can have a mutable or an immutable data type as a value in a dictionary and you can have duplicates as well. So if I created a dictionary with a key say banana and if I gave if I associated with it a value green, I cannot create another key banana and associate a value yellow. Let's see what happens when I actually do this. If you actually see what has happened here is Python has considered the second case. So it's it first looks at the first pair, it goes, okay, so my dictionary has a key banana with a value green. But right after it, it sees another key banana with a value yellow. So it overrides my first key banana with the second key. And it overrides the first value green with the second value. And we essentially get one key banana with the second value yellow. So obviously this is Python does this to avoid duplicacies. However, if I created a dictionary with a key banana again, if I created I gave it a value yellow or say green and if I created another key and if I gave this also a value green, this is perfectly fine and this will not nothing special will happen in this case because values do not have to follow such rules. Let's speak or let's see certain dictionary oper operations and functions now. So let's uh bring back our original dictionary which we had created earlier with the three pairs. All right. So what if I wanted to we can use keys to uh essentially do these operations and functions. Let's see what happens when we so much like how we use sequence how we use indexes in example of sequences we use keys when it comes to dictionary. So let's see what happens when we use a key over here. So we as we know banana is a key in this dictionary. Let's see what happens when we do when we give this command. It actually gives the value associated with that key which is yellow. What if we wanted to change a particular value associated to a particular key? I would give I would do this. I would give the key and assign it uh the value that I want to change it with. All right. Now if I check my dictionary, you can see the key banana no more has yellow value but the value gold. What if I wanted to add a new pair, you know, a new key with a new value completely. I would do it pretty much the same same way as I did in the previous step. I would um essentially write my new key whatever I wanted. Say if I wanted a new key called watermelon, I would assign it a value red. And now if I check my dictionary at the end of the dictionary you will see that my uh new key pair key value pair has been added watermelon red as you can see over here. Now what if I wanted to remove if I wanted to remove a key value pair from my dictionary I can use the delete function which is uh called by using this the deel function. Now how do I do it? Say if I want to remove the key value apple and red. So all I have to do is do d e l d and within square brackets I have to only mention the key. I don't even need to mention the value just the key. So you can probably draw parallels in how we use indexes when it comes to lists and pupils and even strings and how we use keys when it comes to dictionaries. They are quite similar. So if I did this and if I um oops I think red is actually not a key as you can see red is a value my key is apple actually it's not red it's apple as you can see now if I see my dictionary the key apple and its value red has been removed so these are some of the operations that we can do for dictionaries using keys what if we wanted to use certain inbuilt functions that are associated with dictionaries Well, some of the examples are as follows. There is a get function. When we use a get function, all we have to do is enter a key inside the parenthesis and it will get the value associated with that key. So, if I gave the key great, let's see what value is associated with it. As you can see, it's green. Uh there is also a function called items that returns the key and value pairs in our dictionary as a list of two object pupils where the first object is the key and the second object is a pupil. So let's see what it does. As you can see, it gave me a uh list and in this list, the uh objects inside the list are two object pupils where the first object is always the key and the second is the value and it's the same for each of the pupils. So, this is what items function does. Let's see what uh the next so the next function is keys. Let's see what the keys function does. As you can see, it returns a list of all the unique keys within our list. I mean within our dictionary. Similarly, we can there is a function for values as well. And as you can see, it returns all of the different values that are present in our dictionary in the form of a list. Also, it's important to note that if we have a particular value that has occurred multiple times in a dictionary, it will appear as many times it has occurred in the dictionary or appeared in the dictionary in our list over here when we use the value function. So, if say a particular value say I had another key where its value was green again, so I would have the value green appear in this list once more. Essentially our next function is pop item. What this does is much like the pop function in lists. It gives us the last entered um key value pair that is present in our uh dictionary. So the last entered pair was watermelon key watermelon with the value red and that's what has popped out when we give this function. Another important function associated with dictionaries is the update function. And the update function is a very neat function that is used to merge two dictionaries together. So say if I had a dictionary let's say I'm creating a dictionary using the dict function where I have say some key. So as I had mentioned I will use two object pupils in this case and um let's say I give this also a value green. All right and another pair would be say mango and let's give it a value yellow. All right. So this is another dictionary that we have created. As you can see over here we have created a dictionary with a key called kiwi with value green and another key mango with a value yellow. And I already have a dictionary D with uh these values. All right. Now, if I want to merge these two dictionaries, I can use the update function. What I do is say if I want to merge D with X or X with D, only the ordering will change and that doesn't really matter when it comes to dictionaries. So if I want to merge D with X, I use D update and then inside it I put my target dictionary. Now when I check what's in D, I have the the the dictionary X and its key value pairs merged inside my original dictionary D. As you can see, I have my original ones here and I have the merged ones over here. So this was the update function. In this uh brief video, I will explain what we call the type hierarchy or the standard type hierarchy in Python. it it's also known as the data model in Python and it probably has other names. So essentially in the what we do or what we speak about in this is uh how the different types that we use in Python are categorized and classified and what are their subtypes. So it's important to note before we continue further that there in future versions of Python there might be new types that are introduced or the existing ones may be modified but it's safe to say that what I will speak about in this video will still form the core of what we call Python standard type hierarchy. So let's begin. So the first type is the none type. Uh it's accessed through the built-in name none. Its truth value is false. It's essentially used to denote um functions or it's it's returned as the value for functions that don't really return anything. So if you have an expression or a function that returns no particular value, you actually get a data type called none. That is how Python interprets it. Uh then there is the ellipses. Uh ellipses is something that you might encounter later. Uh it is accessed through the built-in name ellipses. um it is used to indicate the presence of this particular um syntax this particular symbol or expression uh or syntax in a slice. Its truth value is true. Again, don't worry too much about ellipses right now. Next is numbers. And numbers is something that we are very familiar with. We have seen we've worked with numbers a lot. They are an immutable type. They are created through numeric literal and they are the outputs of arithmetic expressions and built-in arithmetic functions. Its subtypes are inteious, floatingoint numbers and complex numbers. Um within integers you have plain integers that represent numbers in the range uh this number and this number. So this this number is basically the largest positive value that you can represent using 32 bit notation in two's complement and this is the equivalent for the the negative the negative side. Long integers on the other hand are used to represent numbers in an unlimited range that is only subject to the available memory of your system. So these are two types of integers and as we know floatingoint numbers represent machine level double precision floatingoint numbers or numbers with a decimal point and a component after that. Complex numbers are numbers that contain a floatingoint number that represents a real part and a floatingoint number that represents a an imaginary part. So these are the types of numbers. Then we have sequences. Sequences are finite ordered sets indexed by natural numbers. So each element in a sequence has an index and that index is a natural number. The different types of sequences are based on the mutability. Whether the objects can be changed or not is essentially what we mean by mutability, right? Once we create an object, whether we can modify it or not. Uh that is how we differentiate different types of sequences. So there are mutable and there are immutable types. Now the different types of immutable ones are strings. We know what strings are. There are sequences that contain characters. Uni codes is the other immutable sequence. And then there are tupils. Uh pupils are collection of arbitrary Python objects and uni codes are sequences that contain uni-ode characters. Then we have mutable sequences and uh there is only one currently there is only one built-in uh mutable sequence in Python and that is lists. Uh lists are also again collection of arbitrary Python objects. Finally we have um well not finally but next we have mappings and mappings are again um sets of uh objects but these objects are now indexed using arbitrary index sets. You know the difference between a mapping and a sequence. You could consider um sequences are ordered but mappings are not ordered and uh the indexes given to the objects in sequences are always numbers. They're natural numbers. Whereas in mappings they are not natural number but they are certain arbitrary objects that we can set for ourselves. Again in Python there is only one builtin uh standard mapping type that is the dictionary. dictionaries are they're they represent finite sets of objects indexed by nearly arbitrary values. The only condition is that these indexes must be of an immutable data type. So these uh so what I have mentioned until now are probably the most common data types that we encounter uh or that we have encountered. Now the next types are like callable types such as userdefined functions, userdefined methods, built-in functions, built-in methods, classes and class instances. So again callable types as a whole are referenced using the call function and this is something that we will learn when we start learning about functions when we learn about object-oriented programming uh and methods and functions and such. The other type are modules. So modules are uh module objects or modules essentially are referenced or called using the import function. Again modules can be considered as these large libraries or larger pieces of code or applications that we uh that contain various different methods and functions and objects and classes within them. Um again modules are something that we will think about a little later. Files are data types that are called using the open function. So anytime we and as we will during the course of this uh tutorial we or during the course of this uh this this course essentially we will be working with lot of files these some of these files are text files some of them are comma separated files. So all of these files that we open using uh the function open or some other certain uh specific functions where we create file objects out of these files. These are what we call file data types. Uh finally there are internal types that are used by Python interpreter. Again this is something that uh does not concern us right now but just know that uh the interpreter for Python uses these uh data types for its functioning. In this video I will show you some of the categories of operations that are possible in Python. So let's start off. So the first category of operations are arithmetic operations. And as you can see in this table, there are different types such as addition, subtraction, multiplication. But let's go over them one by one. So a simple addition operation would be like 5 + 6 giving me the value 11. I can do 5 - 3 that's subtraction. Similarly, I can do a multiplication using 5 say 5 into 2. There's division where I use the backslash. So say I did division of 8 / two. Now you might encounter another type of division which is called the floor division where we use a double backslash and what this does is it returns us the largest whole number that is lesser than the result of our division. So the division difference between the float division and the normal floor and uh the floor division or the single and the back double backslash is this say I did 9 / 2 using a single backslash. It should give me as you can see 4.5 right so this is the actual value now let's see what happens when I do 9 double back slash2 it will give me four which is the largest number lesser than or equal to 4.5 that is also a whole number so this is what we call floor division essentially finally we also have uh if we want to raise something to the power of something so if I want to do five say 6 raised to the power three so I would use double asterisk and this is how I would do it it give me 216 16. As you can see, uh if I wanted remainder between the division between two different numbers, I will use the percentage sign. So if I wanted the remainder of the division between 7 and three, this is how I would do it. I get the answer one as you can see. So the next category of operations are logical operations. The first one is the logical and operation where we use the operator and. All right. So let's see uh what we mean by this. I am creating. So as we know the and operation returns a value true if both the operants are true. So let's actually let's actually do this for an example. Let's give this variable the value true and this the value false. It should be done like this true false. So now uh think of it like one and zero. So one and zero is obviously zero right? So if I did A and B, I should get the answer false or zero because I'm doing true and false. So it's like doing one and zero. So if you see this, I should get the answer false. If I change this to true as well. Now if I do this, I will get the answer true. As you can see uh the next logical operation is the or operation where well logical or is if either of the operants are true then we should get the uh answer to our or operation as true as well. So in this case obviously if I did or over here it will naturally give us true. If I change this to false it should again give us true and it will only give us false if both are false. As you can see here now it's false. The next operation is the logical not. Uh it's done by using the not operator. So in this case the value that we get is true if the operant is false. So let's take a as we know a is false over here. So if I did not a I should get the answer true. But if I change this to true. Now if I do not a I should get false as you can see. So this was the uh logical operations. Let's move on to the next set of operations that is comparison operations. So there are a bunch of them. Let's go over them one by one. If I want to check if two operants are equal. So if I did x is say equal to 2 and now y is equal to 3. If I want to check if they are equal I will use the double equals to sign. And if um they are equal I will get the value true. If they aren't it I'll get value false. As you can see since x is 2 and y is three. As you can see x and y are not the same. So there's false. they are not equal. If I change this also to two now I will get the answer to another the next comparison is the uh not equal to or where we use the exclamation sign. So over here this is this um the result of this is true if x and y are not actually it's the same. So I should get false over here as you can see. But if I change this to say five now I will get true because x is not equal to y in this case. The next one is greater than. So if I did x greater than y as we can see 2 is not greater than five I will get false over here. Similarly there's a lesser than if I did x lesser than y I should get true over here. As you can see there's also a greater than or equal to and lesser than or equal to we simply add the equal to sign here. So let's see now if I say x is lesser than or equal to three I should get true because x is two I and if I put two here I should also get true. But what if I put one here? Since x is equal to 2 and 2 is not less than equal to 1, this is a false statement. And I can do the same thing with like this using the greater than equal to. Now it's true because 2 is actually greater than equal to 1. And so this was comparison operations. The next set of operations that we can do in Python are assignment operations. We've already seen a whole bunch. We've already been assigning values to variables. We've been doing assignments throughout already, but let's go over them and see some of the assignment operations. So, as we already know, the equal to operation is assigning everything that is on the or the value on the right hand side of the equal to sign to what is on the left. So, if I did a is equal to 5 + 6, it will assign the value 5 + 6 or 11 to a. Let's check what's in a. As you can see, it is 11. There is a plus equal to sign. And what this does is so for example if I did uh say a now since a is 11 let's create another variable called b and call this five. All right. So now if I did a plus equal to b. What this will do is it will add b to a and then store it in a. So let's see what this does once I do this. Now let's check what's in a. It should be 5 + 11. As you can see 16. So this a plus so this plus equal to sign is essentially the same as doing a is equal to a + b it's essentially the same thing. They're both the same. Uh there's a similar thing for this the negative symb or subtraction as well minus equal to. So now that a is 16 and b is still five. Of course if I did minus equal to b now I'm subtracting the value five from 16. So I should get a is equal to 11 again as you can see here. And this is the equivalent of doing a minus b. A is equal to A minus B. I mean as you can see so uh the next similar like assignment operation let's create A is equal to say 6 in this case and say B is equal to I will say two. Right? Now if I do a star star equal to B. What this does is it multiplies B to A and then assigns it back to A. So if I see what's in A now it should be 12 as you can see here. Similarly there is similar thing for subtraction as well. So if I did a is equal to 6 and b is equal to 2. If I did a sorry for division. So if I did a division symbol and the equal to sign and then if I give b what it will do is it will divide a by b or 6x2 and it will assign that back to a. So my value in a should be three. As you can see here 3.0. Obviously this is a single uh single backslash. So this is a float division. The resultant of a single backslash is always a float. I can do the same thing with a double backslash. So let's see if I did a is equal to 7 now and then b is equal to three. Now if I did a double backslash equal to b. Now it will do the same division but uh it will do a floor function. So it should give me two in this case. If I did the same thing with a single backslash just to show you the difference between single backslash and double back slash division. In this case it will give me um the value around 2.3 or something a float basically 2.33 as you can see here. Then there is the modulus you can use the modulus sign as well with this assignment. Um say a is equal to say five. Now b is equal to two. Now if I do a percentage symbol equal to two I mean the it should give me it will assign the uh it will take the modulus in both sides and then assign it to the left hand upper end. Now let's see what's in a as you can see it it did a divided by two. The modulus symbol is basically the remainder of the division between two objects. So in this case it will divide a by b and then give me the remainder and then put the remainder back in a. And as you can see that the remainder of 5 / 2 is 1 and we get that over here. Similarly, we can also do exponential. So if I have a is equal to say 5, b is equal to 2 and I want to raise a by if I want to raise the value of a by the value of b and then store that back in a this is how I would do it. So it should be 5 to the^ 2 which is 25 as you can see here. So this is assignment operations. So finally we move on to uh two special sets of operators. One is the identity set identity operators and the other is the membership operators. Uh let's look at the identity operators. So when we talk about identity operators what we when what we mean is the is and the is not operator. So what the is operator does is it checks whether two operants uh have the same location in the memory. Essentially this does not mean that it does not check for whether two objects have the same value. And this is very important. So let's look at this. If a is equal to 1,01 and b is equal to 1,00 + 1. All right. If I did a is equal to this is an equality check. Are they the same values? True. Now if I say a is b, let's see what happens. As you can see it's false. This is because this object and this object are not the same. And this is what the is operation does. Uh we can confirm this by checking the id of a. The id of a gives us some value like this. And the id of b gives us as you can see a different value. So the two objects are not located in the same place in the memory as we have seen using the id function and that is what we check uh through the is operator and the is not is essentially just the opposite of that. So so that is the identity operator. Now the membership operator is used for checking whether something is present in a sequence or not. So let's create a sequence. I will create a list to show in this example. My list is 1 2 and three. Basically simple list with three integer objects 1 2 and three. I will check whether now say 2 in a. So is 2 in a. If it is it will give me true. As you can see is five in a it should give me false because five is not in a. And the not in operator is just the opposite of that. It checks the other condition essentially. So this is the membership operators in Python. In this video we will be looking at the math module in Python and we will look at some of the math functions that are associated with this module in Python. So starting off what is this math module? Well uh the Python math module is an important library or a feature that is uh designed to deal with mathematical operations. This math module is part of the basic Python installation. So you don't have to install this separately. Uh to use this math module, all you have to do is import this uh module. And this is how you would do it. You just do import math and this will import your math module for you to use in your programming. And in this in the course of this video, I will be showing you certain um concepts surrounding the math module such as what are the constants that come with the math module, some of the arithmetic functions, the logarithmetic functions, um power functions and even trigonometric functions that we can do using this math module and the functions inside the math module. So uh starting off let's uh look at some of the constants that are part of this. So as you can see the standard constants that are available uh in this module are pi there is toao there is ulers's number n which is a special it's a it's a programming specific concept and infinity. Uh so let's look at these one by one. So starting off our first constant is pi. Um pi is as you know in maths it's the ratio of the of a circle's circumference to its diameter. And uh pi is an irrational number. Uh you know the value of pi is 3.14 something. Since it's an irrational number, it does not we cannot define it in terms of a specific fraction. But it can be approximated to the fraction 22x7. So how do we access this pi constant is as simple as this. Once you have imported maths uh the maths module, all you have to do is do maths.py and it will give you the value as you can see. So as you can see the value returned to us is a float. This is important to note. And the number of number of decimal digits uh the number of digits after the decimal point that we can see here are 15. And this is like a by default uh thing for Python that if you call the pi constant it will give you the value of pi correct up to 15 decimal points. So an example of where we can use this thing is say we have the radius of a circle three. It can be in any units 3 m or whatever you want. Um and you want to find out its say circumference. So as we know the circumference of a circle is 2 pi r. So if I had to find the circumference of a circle in my in my code for some application with the radius 3 or all I would have to do is use the formula 2 pi r and uh to call the value 2 pi r instead of specifically writing 3.14 something I can just use this function math.py pi over here and then I can enter the r as you can see it will return me the radius as you can see. So moving on uh the next constant that we will talk about is toao. Towao is similar to pi. In fact toao is the ratio of a circle circumference to its radius. pi is the ratio of a circle circumference to its diameter and toao is the ratio of a circle's circumference to its radius. It's important to note this difference. So because of this definition toao is always two times the value of pi this is by definition and much like pi if you call the toao constant in you from the math module it will also return you a float number and to find that this is the function that we use or this is the syntax. So as you can see this is this is actually two times the value of pi 6.283 283 and even this is returned correct up to 15 places to the right of the decimal point and this is by default. Uh next constant is the uler's number. Uh the uler's number is a it's one of the most widespread constants used in the world of sc uh in the scientific community and the mathematical community. Um you will be using the uler's number probably a lot as if if you move into data science or AI or something like that. So what is the uler's number? It is uh it is the base of the natural logarithm. If you know what the natural logarithm is, it is used to calculate rates of growth or rates of decay. And as with numbers or constants like pi and toao, even the ulers's number is an irrational number with infinite decimal places. The value of the ulers's number in short it's denoted by the small letter e. So this value of e is or usually approximated to around 2.718. So how do we call this uh constant is simply as math e. This is how we do it. So you get this value. Again this is also a float and it's correct up to 15 decimal places. So the next concept that we will be talking about is infinity. Now infinity is a it's more of a mathematical concept and this is very important to note because infinity doesn't is not really a number. There is no number called infinity. It is it is used to define something that is infinitely large or infinitely small. So positive infinity is something that is higher than any known number to us and negative infinity is lower than any known number to us. Um so this is the concept of infinity and how do we call this uh function? Well so let's see what happens when we call the math function math constant infinity. So this is how we do it and as you can see it will return us this um it might look like a string to you but this is actually a special type in Python um which is not a string this is also a float it's a type of a float in fact this uh infinity value it's it's a it's like a special data type it's a special data type that you can you can consider as an equivalent to a float but um it's not it's not a typical float that we know like you know 3.14 or 2.71 the value of math int will give us inf and this is this inf is actually not a string so we can we can confirm that over here as you can see when I do a type when I check the type you see it's actually a float in fact this was recently added in python 3.5 a special type known as math inf um it returns this INF data type which is the equivalent to a float uh so this is this is how we use infinity if you wanted to get the uh value of say minus infinity all you would have to do is math do inf with a minus sign preceding this uh constant and you will get minus inf. Now let's check if the concepts or the properties of infinity are maintained you know like every a positive infinity is greater than any number that we know and negative infinity is greater than any number that we know. So let's just confirm this. Um so I'll take math in and I will do a check is this greater than say some really large number something that comes off the top of my head immediately. Okay. So let's see if it's if this is true then uh this is conceptually correct and as you can see it is true. In fact I can change this number to anything as large as I want. This will be true because infinity is true is larger than any number that we know. Uh and similarly if I did minusmath.in in INF uh and I checked some very small number you know a very very small negative number so just consider some minus 10 ^ something right this should also be true uh sorry it should be smaller than symbol this should also be true because I'm checking minus infinity is smaller than any known number to us and it is true as you can see so it's very uh also if you did a if you did something like so let's say if we do uh let's add something to this you know it's a number. So we should be able to do arithmetic on this. Let's actually see what happens when I add say 10 to positive infinity. It actually gives us the same value back infinity because uh intuitively we know that infinity plus anything is still going to be infinity. Right? And this is exactly what Python does for us. Even if we add a number to this the math infinity constant in Python, it will still give us uh the same value the same data type of inf or infinity. Similarly, if we subtracted something from the negative of math.inf, you know, say minus say again let's say minus 100. So if we subtract something from minus infinity, we're technically still minus infinity itself. So this will again give us minus and minus inf as you can see and this is absolutely what we need and this is a very very interesting feature in Python. Uh finally the last constant that we will discuss is the nan or the not a number constant. So this is not really a mathematical concept. Uh there is no constant in maths called not a number. This is a computer science related concept that it's it's used to it's used to denote invalid inputs or in it's used to indicate certain places where say a variable that should have a number um it's been corrupted for whatever reason and it it now has a text or a symbol and our code throws an error. Then in these in these cases where Python expects a number from us or from your code and it does not get it, it will throw you a nan um value and this is usually used in cases where you have errors in your code. So uh again just to check like what this this constant like how to call it this is how you actually do it math. Nan and it will give you a data type called nan. Also much like the infinity constant, let's see what's the type of this um this constant. Again, might look like a string to you, but of course this is not a string. This is a a numerical concept. And as you can see, it's still a float. So this is like um it's another special uh data type that was created for specifically this case where it's some it's the equivalent of a float, but um it's not really the typical float that we are that we associate with. So this is uh constants in the math module. So our next topic will be arithmetic functions that we can do in the uh using the math module. So some of the common arithmetic functions that are available to us are factorials, the ceiling operation, floor operation. Uh there's permutations, there's combinations, you can find the greatest common divisor or the GCD and the LCM or the least common multiple and you can truncate numbers. So let's look at them one by one. So starting off with the factorial operation. The factorial operation is done using the factorial function. As you can see here actually is defined like this math. Factorial. All right. So now what we pass in between the parentheses will be uh what we calculate the factorial for. As you know factorial is so factorial is always for a positive integer and the factorial for say a number 10 would mean 10 * 9 * 8 * 7 so on until the number one. Obviously factors are only defined for positive integers. Uh it is not defined for negative values or it's and it's also not defined for decimal values. So let's leave let's look at an example. So as we know um so let's say we pass math factorial for six and let's see what's the value. So this is exactly what we expect. So we expect the value of 6 * 5 * 4 * 3 * 2 uh that is actually 720. Let's see what happens when we pass zero. This should give us one since we know 0 factorial is one. Now let's see an error case where we pass say minus5. As you can see this will throw us an error because factorials are not defined for negative numbers. Now moving on let's uh so the next function that we'll talk about is the ceiling function. So the ceiling function is defined using math do seal as you see here. So again we pass the number that we want the ceiling for in between the parenthesis. So what is the ceiling function? It gives you the largest uh sorry excuse me it gives you the smallest number that is uh greater than or equal to what we pass over here. So for an example if I gave you 6.6 and I asked you okay what is the ceiling function for 6.6 it should give you 7 because 7 is the largest inte integral value that is greater than 6.6 or equal to it. Obviously if you give the ceiling function for an integer it will give you the integer itself. So let's look at an example 7.8. So this should give me the value 8 as you can see here. Let's look at another negative number. So -2.3 uh an integer that is greater than -2.3 is -2. The smallest integer that is greater than - 12.3. And this should give you 12 as you can as you can see here. Uh a similar function is the floor function which is defined like this. Again the floor function what it does it gives you the greatest number that is smaller than whatever value we pass between the parenthesis. So if I gave it 2.3 it should give me the value two. Um again if you pass integers it will uh just give us the integer itself. Again just to reiterate this uh ceiling and floor functions uh they give you inte integer values. So the floor function will give you the largest integer that is smaller than what we pass over here. So let's look at 6.7. So the largest integer that is smaller than 6.7 is six. And as you can see this is our answer over here. Uh the next function that we will look at is the truncate function. U the truncate function is defined using this. Truncate is very similar to what we have seen. This is how we define the truncate function. Uh it is very similar to the ceiling and floor. uh in the truncate function what we do is um we pass a decimal value a float number to the between the parenthesis and what we get back is the number without the decimal component so only the integral component so if I gave it 7.8 8 for example it will give me only the seven part it will return me only the seven part and it will chop away the8 part um if I gave it minus 12.3 it will chop away the.3 part and give me only -12 back so let's look at an example 8.9 it should give me only 8 as you can see here say I did minus 8 uh or minus 6.9 it should give me minus 6 so you can think of truncate function as it does the floor function for positive positive values and it does the ceiling function for negative values because it rounds down and rounds up respectively for positive and negative values. So now let's look at the next set of arithmetic functions. Um let's move on to permutations. Permutations are defined using this as you know. So in between the parenthesis I have to pass two values n and k. So I have to pass n and a k. The k has to be less than or equal to n because the permutation as you know is uh the number of ways in which we can permute from n objects k different objects. Uh so what this mathematically what this is is um permutation of n and k is n factorial divided n minus k factorial. So if I pass say 10 and 6 it will give me the permutation of 10 and 6. So let's look at what's the value. As you can see it's uh this very large value 15 15 1,200. Similarly there's a combination function and this is uh combinations of permutations are used a lot in probability. So if you're going to move into that sphere which you will encounter a lot in um machine learning AI you will be using these functions quite a bit. Um so the combination function again you pass an n and a k. Again the n should be greater than or equal to this k. What this evaluates is n factorial / n minus k factorial * k factorial. So again this is a mathematical concept. So let's look at the permut sorry the combination of 10 and six. So as you can see it gives me 210 which is the combination of 10 and seconds in the arithmetic function section. Um are gcd and lcm as we know gcd is the greatest common divisor. LCM is least common multiple. So as of the newest version of Python in 3 Python 3.9, the math module gets these two new functions that were very lately added actually um since uh I cannot show you that because I don't have the absolute latest version of Python on my system. But using the math.gcd function, this is a function and in between this we would what we would do if we had the latest version is we would pass two numbers or as many numbers in fact and what this function would do is find the common divisor amongst them. So if I gave these say for example if I gave these numbers it would give me the value 10. Similarly the LCM function again added in Python 3.9 finds the common multiple amongst what whatever we pass over here. So if I passed say 20 and 30 this will give me uh the value of 60 which is the LM of 20 and 30. So again these are it's something neat that if say you have Python 3.9 or uh if you have Python 3.9 or after that you will have access to these functions as well if you when you import the math module. So that was for the arithmetic uh functions. Let's move on to the next section which are power and logarithmic logarithmic functions. So let's start off with the power function. Um there are two there are multiple ways you can actually do a power function in math uh in Python. So you can do something like this which is the equivalent of 2 ^ 3 or you can use the inbuilt uh module math and you can use the p or the power function which is this is how you do it and uh if I had to do same 2 ^ 3 I would just pass 2 and three as arguments like this and it should give me the value as you can see eight over here what if so there's actually one more function which is simply the p function and this is not part of the math module it's a function function not part of the math module but it's still part of the base Python you can use this as well and you can do the same thing p 2 and 3 it should give you the value 8 again the now you might ask what's the difference between these two functions well it's not much for at least in a beginner standpoint it's not that much uh just note that the math power function is slightly computationally faster than the simple power function so yeah moving on there next topic would be the next function that we'll discuss is the exponential function fun which is defined like this again exponential function is again e to the power something so if I did exponential of three this would give me e to the power 3 as you can see oh of course I did not define the module beforehand so math exp now when I do this it should it'll give me some value which is basically uler's number e to the^ 3 so this was the exponential function and let's look at uh an example so we will look at the example of rate of decay and we will use the uh this function in in that example. So the exponential rate of decay um for is used to calculate the amount of radioactive elements that is present in a substance after a certain amount of time. So the the the the expression is uh something like the initial amount of radioactive elements that were present right at the beginning times the exponent of - 693 * t t for time divided by the time period the halflife time. Uh so let's just write it down to make it simple. So again as you can see the uh so this will give me the remaining amount of radioactive elements right. So let's uh let's write down remaining let's assign this to a variable remaining. So the initial again um initial is the initial amount of radioactive elements. So let's give it some value say 100. um the time let's assume it's 10 years uh and let's say the halflife um halflife is around I don't know let's give some value say three or something again this is uh the details are not important so this will uh I'm using the math exponential function over here as you can see and for these values uh now when I check what's the value of remaining after I calculated it it's something uh so this is it's basically what this tells me is that I started off with 100 units of some radioactive element um and in 10 years this is what is left. So yeah so this is how we would use say the exponential functions in a particular example of ours. So next type of again functions are logarithmic functions. So let's look at some of the logarithmic functions that are part of the math module. So basic log function would be written like this math.log in between this I would pass the number that I want the log for. By default, if I just pass one number, it will it will calculate the log of 8 to the base of e. As we know, e is the uler's number. So let's see what it does in this case. Gives me some value. What if I wanted to specify a particular base? Well, I would pass a second argument in this case. I want to find the log of a to the base 2. This should be the value three. As you can see over here, uh there are two specific functions that are also provided in this math module that is log two. What this will do is again it will again I have to just pass one argument and this will automatically find the value the log of 8 to the base 2 as you can see here. Uh similarly there is a math.log 10 function. If I gave if I did this I will find the value of uh something here to the base 10 as you can see. So this was logarithmic functions. Then you have the finally you have the square root function. So how would we use the math uh the square root function is math.sqr. sqrt again we pass what we want over here if we want the square root of say 49 this should give me the value 7 as you can see finally we move on to the final set of functions that we can do using this math module they are trigonometric functions and they are hyperbolic functions so uh let's start off with some of the trigonometric functions as we know um we can do s we can do cosine and tan some of the basic functions Um the way we would do it is math dot sign. Um in between this what we this is to calculate the sign of a particular uh angle and this angle must be passed in radians. Uh this is very important to note we do not pass it in degrees but in radians. So if I say pass s of 3.14 as we know 3.14 is an approximation of the value pi. Uh sin pi is uh supposed to be uh in fact it's supposed to be zero. So let's see uh we get something close to zero. Again since this is an approximation it won't give us the exact value. Uh similarly we can use math dot cos to find the value of a particular angle. Um if you want to find if you want to find the value of the sorry the cos of a particular angle we can use the tan function in case we wanted to find the tan. Similarly we have the next set for arc sign and the arc cosiness of uh certain of angles. So to use to find the ark sign for example we would use a dot sign I mean sorry a sign. Uh for arc cosine we would use this and for arc tan we would use this. The next set would be hyperbolic functions. Again hyperbolic functions are are basically the sign and the cosine and the time calculated not circles but on hyperolas. Uh again the details don't have to be you don't have to know the details. You just should uh you should know that if you wanted to say for example find out the uh hyperbolic sign of an of an angle we would use math dot sin h and then we would pass what we wanted between this. Similarly if we wanted to find the cosine it would be cos h tan it would be tan h and if we wanted to find the inverse of the hyperbolic inverse what we would do is what we would do is use a. So we would use a tan h. If you wanted to find the hyperbolic inverse uh of sine, we would use a sin h. And similarly for cos, it would be cos a cos h. In this video, we will learn about conditional statements. Uh and we will learn about uh how do we create these control structures where we have these conditional statements. Uh we will learn about the keywords that we use in Python to create a conditional statement block. The if keyword, the l keyword and the else keyword. uh we will also learn about indentation and its importance in Python. So let's get started. So the basic uh syntax if you will for a if statement in Python consists of the keyword if followed by an expression as you can see from this uh pictorial. Uh it there's an if statement there is a expression uh there is this uh block of code which if you can actually see is slightly indented to the rest of the code. Uh and then we have the rest of the rest of our code after that. So what we're looking at is this. So this is our if statement block. Um now let's let's break this down. So what is this expression that we're speaking of? Uh an expression in this context is a boolean expression which evaluates to a true or false statement. So when we are speaking about the if statement we have an expression and if this expression evaluates to true then we ex execute everything below the if statement otherwise we skip that portion. As you can see if this statement is true we execute this statement or these statement blocks. Uh otherwise if it's false we move on to the next the next statement block or the beginning of a new statement. Uh so let's look at an example to uh further understand this. Let's take this if statement over here. As you can see in this if statement I have this expression 50 greater than 30. So what Python is going to do now is it's going to check whether 50 is greater than 30 and it's going to check in a boolean context. If this is true then we can move on to the next portion which is this. But if it is false then we will skip this. So let's see what this uh what happens over here. So since we know that 50 is indeed greater than 30 this is a true expression. we move on to this block of code which is saying that print 50 is indeed a larger number than 30. So let's see if this actually gets printed. So as you can see we get this uh the result which is this is a true statement and we get our print statement getting executed. What if we gave a false expression over here? So let's look at uh what happens if I give a false expression. Now I'm checking if 50 is lesser than 30 which is a false statement. So if it's a false statement, we do not move on to this portion of our if statement block and we we directly in fact we directly skip. So if I have to execute this, you will see nothing gets executed and in fact my print statement is just not executed because we never entered this because our expression over here was indeed false. So yeah, this is how a basic if statement block looks like in Python. And this is how the uh how we move on to how we check for the truth the truth truthfulness or the falseness of a particular expression in the if statement. So moving on um let's move on to the topic of indentation in um in Python. So as you can see this uh this if statement is an example of a control structure. So without moving without defining what a control structure is uh in detail control structures consists of these uh conditionals or loops or iterations if you will. Uh so all of these control structures involve heavy indentation. So what does an indentation mean? Well, what if I gave you an example? Say I gave you some variable called age and I wrote 20 over here. Now if I gave you an if statement saying if age is greater than 10. Now uh it's very important to note that when I'm defining an if statement I need this colon otherwise this if statement is not defined. So this uh colon is important. Uh anyways so now I'm checking this expression if age is greater than 10. Now what is this? What happens if age is greater than 10? Now what if I want Python to do something only if age is greater than 10? Well, how do I tell Python that there is a piece of code or a section of code that I want executed only if this condition is met? Well, this is where indentation comes into play. So, if I want say if I want this line, this person is an adult. Again, this is some random line where I'm assuming age is pertaining to this adult. All right? Or this person. So if I have uh this variable age where I write this uh number 20 which denotes the age of some some person and I'm doing a check if age is greater than 10 actually let's be specific here. Well the adult age for most people is 18 in most countries. So let's see if age is greater than 18. Now if I'm doing this check uh I want to print this statement only if this person is person's age is above 20 uh above 18. So how do I tell Python that I only want this statement to be uh executed only during this if this condition is met? Well, this is where indentation comes into play. And as you can see, exactly as you can see uh this part, this portion of the code is slightly indented compared to the if statement. So when this condition is met, then only do we move on to this. If this condition is not met, we move on to whatever the next section of code will be like whatever whatever uh code that we have after this if statement. So let's see. So this since this condition is actually met, as you can see this print statement is actually executed. So this is the importance of indentation. Now we will see uh in as we move as we learn more about if statements and else statements and l if statements how indentation plays a key role in defining what we want as an output when a certain condition is met. All right. So for now it's very important to understand that uh this is how indentation is used in Python. In other languages we might use uh we we probably don't use indentation. In fact popular language the C language does not use indentation at all. But some languages and Python in probably the trademark language for uh indentation in programming. So you might say that uh so different people have different opinions on indentation. The general consensus is that indentation helps make the code look very presentable and very readable and this actually is one of the facets of Python programming is the indentation and the easy readability of it. Anyways, moving on. So what if we have um multiple conditions in our code or in our if statement block that we want to see. So let's create this um list or let's actually just copy this example that I have written over here. As you can see what I'm doing in this piece of code is I have a list X where I have this integer 50. I have two strings gat and apple. Now I want to check a bunch of things. So I want to check if 60 is an X and I also want to check if the string cat is an X. Uh and I want a final sort of like if none of these conditions are met, I want something to happen. So how do we do that? Well, we start off our state our if statement block with the standard if keyword. All right. Now if we have one more condition that we want met, then we can use the l if which is kind of a short form for else if. Uh so we use the l if keyword. So it so what this Python uh what Python reads is it checks this condition then it will check this condition. And then finally we have this else keyword and else is a keyword used in our block to tell Python that if none of our earlier expressions have been true then do what is in the uh that is within the else keyword that is indented within the else keyword. So again we don't pass an expression for else because else is only we only reach this l else statement in case all of the earlier conditions have not been met or have come to be false and not true. So let's look at uh this particular code example. So we have a list of 50 cat and apple and I'm my first expression that I'm checking is uh is 60 in x. So this is how we check actually. So if 60 and X should be read as is 60 in the list X. So is 60 in the list X? Well actually no. We don't have the object 60. So this part is not executed. We move on to the next condition. Is the string cat in X? Well actually it is uh the string cat is indeed in X. So we move on to this statement block which is within the condition that is met which is print cat is in list X. And you will see that uh none of the other statement blocks will be executed because we have met our condition over here. So if I execute this as you can see that uh the print statement cat is in list x is what is actually executed and we do not uh execute this obviously because it is false and we do not even check or we do not even move on to the statement because well we have a condition met over here. So it's uh one thing that is important to note is that we can use as many L if statements to check for as many conditions that we we want to check for u but it's very important that we only use and if we are using where we only use one else statement and only at the end of our block. Okay. So moving on now I'm going to show you a very neat example about how Python actually does its uh these condition checkings. So it's very important to note that once a condition is met, none of the other conditions are even checked for. So um we do not even consider the next statements and we directly leave this uh if statement block. So let's look at this example over here. Now in this example that I have over here is where I've stored the string cat in x. Now I have three um I have three conditions that I'm checking. I'm checking is 50 greater than 60. I am checking if the value of x is indeed cat and I'm checking I'm some random expression 1 divided by 0. This is not even a check. This is literally just checking if 1 / 0 is true or false. And as we know we cannot divide anything by 0. So let's see what happens when I execute this statement. Now typically if I wrote 1 / 0, Python will throw me an error because one cannot be divided by 0. That is an error error in a statement. So let's see what happens when I do this. Actually as you can see I have a statement being printed but I have no error even though I gave a wrong I gave an error in a statement in 1 divided by 0. Well now you might ask why is that so? Well it's simply because I have actually never reached this condition. I have not even uh Python has not bothered looking at this because if you actually see there is a condition previous to this uh over here which is met and which is true. So we move on to this block. We execute this block and we forget about the rest of the code. So we don't actually get to uh this error statement which is an interesting thing and which is an example that I have shown uh to to show you that once a condition is met in an if statement block we do not look at any of the further conditions that are being checked. Okay. So finally um I have one uh one small topic that I would like to share with you is the conditional expressions or the Python turnary operator. Now this is slightly different to the if statement that we have talked about up until now uh in the sense that it is not a control structure. So what this actually is is more of an operator that defines some expression. So let's see what I am trying to say over here. So as you can see over here highlighted is the uh syntax for what I'm trying to talk about this turnary operator. So let's look at this example and let's see what I'm trying to do over here. So I have this variable age. All right. And this age is 26. Now x now just just read this uh statement x is equal to adult if age is greater than 18 else child. Now I could have done an elaborate control structure with an if statement then an indentation within that if statement and then um I could have written else and then another indentation and I would have written another statement over there but instead of that I have used this uh operator to assign a particular value to the variable x and this what value I'm assigning to x depends on if this condition is true or false. So uh as you can see the condition says is age 18 uh greater than 18. So if this is true then I assign this particular string. If it is false then I go on to the else statement and I assign this. So since age 26 is greater than 18 I should assign the string adult to x. And as you can see if I execute this and check what is an x. You can see adult is indeed an x. So this is a very neat, a very needable, readable, and a very um it's a it's probably a more it's it's a better looking way uh to perform simple else uh simple if and else statements where you don't want to create a whole um if state if if else statement control structure block. So yeah, this was the turnary operator. Finally, we let's uh we we make a short note on the pass statement uh in Python. So the pass statement or the pass keyword is a a place where is is a placeholder of sorts. So what if I had an if statement and I'm writing a piece of code but I don't know what to do with this if statement. So if if a statement is correct if a statement is true um but I don't know what to do if this statement was true. How do I tell Python? Well, let's just keep it a hold for now and I might put something into this uh block later in the future. Well, I would use the past statement. So if I had this uh say there some condition again I'm checking age is greater than 18 but I don't know what to do with this I would just simply use this pass statement and uh this basically does nothing. Uh it's a way to it's it's like a way to create a placeholder where maybe in the future I might have I might write some sort of a say a print statement or some sort of uh different function or something else within this indentation. So but in the meantime like currently I don't have anything to place over here. So I just leave it with a pass statement. So this is uh a way where you can use a pass statement in if else statement or if else control structures. In this video we will be uh I will introduce you to the concept of iterations in Python and we will be speaking in specific about the indefinite iteration in Python otherwise known as the while loop. So let's look at what an iteration means. An iteration is executing the same block of code over and over potentially many times. A programming structure that implements an iteration is called a loop. Now in programming we have two types of iterations definite and indefinite iterations. And in this example we will be speaking about indefinite iterations. Indefinite iterations in Python is the while loop where we use the while keyword to define an indefinite iteration. So uh let's look at the basic syntax. As you can see this is the basic syntax where we have the while keyword followed by an expression and uh again the colon and below that is something indented. Again we encounter indentations just like in if statements uh a set of statements where um what happens here is following the while keyword we have this expression where um this expression is evaluated in a boolean context. Again we check if this expression evaluates true or false and if it is true we uh execute all the statements or the statement block that is indented below this while statement. Uh this is another example of control structure much like if and else statement blocks where we use a lot of indentation. So let's look at a basic example now of while loop. So let's copy this example and let's see what this does. So I have a variable n where I am assigning it a value zero. This is called an initializing process. And it's very important to note that most while loops consist of an expression which contains a variable, a control variable uh which is usually initialized prior to starting the loop and then this control variable is typically verif modified somewhere within the uh main loop body. So in this case my control variable is n and I am initializing it by assigning it the value zero. So let's uh move into the loop now. So the loop has this while keyword as you can see followed by a uh an expression n lesser than or equal to 5. Now what this is is an expression which is going to check if it's true or false. Is n lesser than or equal to 5? And as long as this expression is true, we will continue doing whatever is indented below this while statement. And what is below this while statement is a print statement first of all which says value of n is and it basically prints the value of n in that particular iteration. And as you can see this uh compound assignment where we add the value of n by one and we assign it back to n. So what this is uh let's see what this does actually let's execute this and see what this does. Uh important to note the value of n again is initialized at zero. So this while loop will keep going on until the value of n remains lesser than or equal to 5. So as you can see I have the execution of this uh particular block of code or this while loop where I get the a multiple different iterations of this print statement that you can see here. The first iteration it says value of n is zero. Then it says value of n is one. What I'm doing is I am writing I am assign I'm writing uh the value of n multiple times. uh and each time the value of n is written over here based on what iteration it is. So what is happening actually is uh that initially the value of n is zero and I print this statement value of n is zero. Now I add uh the value of what is in n by one. So now what is the value of n? So again we do this check. So after this first iteration we come back or like once this whole uh code block of code is executed we again come back to this expression and we again check if this statement is true. So now that the value of n is actually one this statement is still true. So again we execute this and that you can see over here value of n is one. Now again we add the value of n by one and again we go back here once this uh this block is executed and we check if this statement is true again. And as you can see the value of n when it's two is still making sure that this expression is true. And this keeps happening until the value of n is greater than five. So once the value of n becomes six, this condition is no longer met. And finally we do not execute this statement because this expression evaluates to false and we do not do this anymore and we finally leave our while loop. So let's check what the value of n is just to confirm this. As you can see the value of n is indeed six and that is why we have left this while loop over here. So this is an example of a basic while loop where we check for this an expression. If it evaluates to true we evaluate everything within it. Once this is done we go back and we evaluate this expression again. If it is again true we again go back and do whatever is indented within it. And we keep doing this until the expression gives us false. And interestingly, we don't uh we don't necessarily have to define these control variables always. We can actually use uh iterables and we will learn about iterables actually in a future video. But uh we can use iterables and an example of an iterable is uh the list. So let's look at this list and let's look at this whole block. All right. So I created this list a which contains five objects 1 2 3 4 and five all integer objects. And I have another variable x where I store the integer one. Now I'm this while statement. Now it might look confusing. Now it says it says while a. Now what is a? Well a is not uh your typical expression where you're making sure if some condition is being met or not. But this the way you read this is while a exists. So in the context of a list as long as a which is a list contains objects within it a is true. If it does not have any objects within it a is false. So while a basically what it means is while a has objects within it and if it does have objects within it or as long as it does we continue executing whatever is indented within this while statement and this while statement is a print statement. Again we uh do like we we have this value x where we um we're doing this this we're printing this is iteration number and uh we pass x. So the first iteration will obviously pass x is equal to one and then we add x by one and then the second iteration should pass this is iteration number two and then so on and finally we have another statement within this block called the a called the pop statement where we're popping the elements of a. Now as if you would have seen the list video on lists the pop statement removes the rightmost value from a list. So if I do a pop initially it will remove five from this list and I will have the rest of them. Again if I do pop it will remove four from this list and then you will have the rest of these. So let's actually see we'll actually check what's left in this list each time we do this pop statement. So I'll also print the list a each uh during each iteration and let's see what happens over here. As you can see what is happening out here is while a or while a has elements we are going to continue doing this while statement whatever is within it. So in the first iteration obviously we have all of it uh and it is iteration number one and as you can see the list contains everything. Then I pop it. Then iteration number two it again has elements but it has lost its most rightmost element. And this keeps on happening until the list finally has no elements left. And once element or once the list has no elements left we this expression while a evaluates to false and we do not execute this anymore and we leave the while loop. And again let's check what is in a. A should have no elements. As you can see it's an empty list. When I check what's in A, it's an empty list. And that is why while A returned near false and we did not print any further. So this is an example of using a while statement using lists. Uh and of course the next topic would be discussing nested while loops. And um this is a broad topic. What I mean by this is that when when I'm saying nested while loops, I'm actually talking about nested control structures. So we can have while loops within while loops. Not only that, we can have if and else statements within while loops. We can have while loops within if and else statements and we can have if and else statements within if and else statements. So if you think of all of these loops uh and we will even speak about for loops in the in the in in a in another video. For loops again are type of control structures. So all of these are control structures. While loops are control structures, for loops are control structures, if and else statements are control structures. All of these are control structures and nesting can happen within them and it does not matter which is the like the parent of the nest and then the child of the nest. You can have a while loop within an if and else statement. You can have for loops within a while loop. All of this is valid in Python and uh it's one of the one of the great features of Python that is very flexible in this way. So let's look at an example where I have a while loop within another while loop. So I'm copying this piece of code where I have this list 1 2 3 4 5 and another list first and second. Now my first while loop I print I print what is popped from a. So I take a then I pop the zeroth index. So basically from the left hand side and I print what is that. All right. And then I have another while loop where I have this list B and I'm doing the same thing. But this while loop is within the first while loop. And let's see what happens out here. So as you can see my first my first iteration of this parent while loop causes me to pop what is the first element which is one. Then I do these while loops and this is completely executed and only then do I go back to this first one and then I come back and do all of this again. Then I go back to this one and then I come back and do all of this again. And that's why you can see this repetition. So I have this first iteration and then I do uh the second while loop. Then I have the second iteration and then I do the second while loop and I keep doing this and this is an example of a nested while loop. Okay. So our next topic in uh this in this video would be break and continue statements. Now break and continue statements are ways to abruptly end iterations uh in in a particular loop. You can use break and continue statements not only in while loops but you can use it in also in for loops. So let's look at how we use it in while loops and let's look at what we mean by break and continue statements. First of all, well, the break statement terminates the loop entirely. So once the break statement is found the the complete while loop that we are using is completely terminated and the continue statement on the other hand terminates only the current loop iteration and it goes back to the beginning or the expression and it checks whether uh the expression or the the controlling expression is again reevaluated and it is checked whether uh the loop will execute again or terminate. This pictorial that you can see here actually emphasizes or it shows the difference between break and continue. So I have this while loop and I have an expression. All right, I have a bunch of statements and I have a break command over here and I have a continue command over here. So if I encounter the break command, it will not execute any of this. In fact, it will not execute this while statement at all and it will move on to the next piece of code that we have. But a continue statement if a continuous statement is encountered in a while loop will not completely break away but it will not uh it will not execute the the rest of the statements in that iteration only these two but it will go back here it will check this expression again and again we will do this all over again. So this is small uh difference between the break and continue statements but both are used to abruptly end an iteration in a loop. So let's look at an example of how we use the break statement. So I will use this example where I have again I have initialized some controlling variable n to zero. Uh my first loop will check whether n is less than equal to 5. If this is true then I will print this statement. Then I will what I'm doing over here is I am incrementing it by one. Now in my previous my earlier example using a similar uh using the similar example uh I had no like this this part was not there. So what you got was I was printing the value of n. So it was printing as like value of n is one I mean zero and then 1 and then two and then three four and five. But over here I've included a small I've nested an if statement and within that I put a break statement and this if statement is checking if if n is equal to equal to two. So once n is two I move on to this and I do the break statement. So let's see what happens now. As you can see once so when I've executed this I don't get the whole value of n is zero and then 1 and then 2 3 4 5 I I stop at one and that is because once n is equal to two I actually do not execute this while loop again. I do not go back and execute print value of n is two. Now in fact I break from this whole while loop and my while loop terminates right then and there. And that's why you only get these two iterations. Value of n is zero and then value of n is one. Okay. So now I'm going to show you a neat example of what happens or what is the difference between a break and a continue statement. Okay. So let's h go back to our initial example where we're printing this value of n is 0 1 2 3 4 and so on. But I have added one more statement where I print hello at each iteration. So let's see what happens when I do this. As you can see it will print hello after each of whatever I was doing already. Now let's introduce our break statement first of all. So when I do break well let's go back to this if statement. If is if we check this condition then we break. Let's see what happens now. As you can see something interesting has happened where we have this first iteration completely being executed but the second iteration kind of stops where there's no hello and that is because we have broken from this while loop before the second iteration's hello was printed. Let's see the difference between a break and continue now. So now I have this continue statement instead of a break. Let's see what happens here. As you can see, it seems familiar to our first example where we did not have any break or continue. But there is a small difference that I want you to catch and that is very important about this continue uh statement. So as you can see the first iteration has value of n is zero and then hello then value of n is one but there is no hello and this is because and this is because once this condition is actually met we do not move on to this statement but we go back to this expression and we evaluate this expression and then once we evaluate this expression again and it's found to be correct. We do everything the same again where we print hello but except for that one step where this if statement was met and we did continue and this following statement was not executed and that happens only for one iteration and that is when n is equal to equal to two and as you can see that is what happens over here in one of the iterations we miss a hello and that is the difference of the continue statement between uh that is the difference of the continue statement with the break statement. This video will be an extension into that topic where we will be looking at three examples where we are using while loops along with other stuff like say if and else statements. So our first example will be where we calculate the factorial of a number. In this example as you can see here we are first going to ask the user to enter a particular number for us. Now this number is supposed to be an integer. Once we have this integer we store it to a variable called number. Now we have this you can say this uh variable called fac which stores one and you we will see how we are using it later. Now we know that the factorial of zero is one. That's how it's just defined. So we have an if statement checking whether our entered number is zero and if it is zero we say that the result is one or the factorial is one. However, if we enter a number that is greater than zero, we must calculate the factorial for this number. And that is what we're going to do in this else statement block over here. Now, in this else statement block, we have a while loop. In this while loop, the condition is checking while number is greater than or equal to 1. So, as long as this condition is true, everything within that while loop will be executed. So as long as number is greater than equal to 1, we are going to execute these two lines. Now what do these two lines do? Let us see. So the first line takes the variable fac where we had the number one stored and we're going to store FAC * number into it. Number being the number that we have inputed. So in case for example we we entered 8 then what this will do this line will do is 1 into 8 and it will store that back into FAC. Now once that is done we move on to the next line where we are decrementing the number variable by one. So if we have stored eight or we have entered 8 into our input it will become seven. Now as we know 7 is still greater than equal to 1. So this condition is still being met and then we do this process again where we are going to multiply fac stores the value 8 and we multiply times the new number which is seven now. So we do 8 into 7 and then again we decrement this uh also once we do 8 into 7 we store it back into FAC and we keep doing this where we keep multiplying 8 * 7 and then we decrement the number variable uh by 1 and then we check this condition again. So what ends up happening is we are going to keep doing 8 into 7 into 6 into 5 into 4 into 3 into 2 into 1 and once we are at 1 again when we do this decrement operation the number variable will store the value zero and then this condition will no longer be met. So number will be zero and this condition will be false and we can move out of this while loop. And then finally we store the result into a variable called result which stores the result of 8 into 7 into 6 into 5 into 4 into 3 into 2 into 1. This is of course if we did enter 8 when we were asked to give an input. So let's see this um in real time once we execute this. So I'm executing this. The first thing it asks me is to enter a number. So let's say I enter my number eight as I was speaking about 8. All right. Now that I have entered eight, as you can see the result that it gives me is factorial of 8 is 4320 which is correct and you can check this for yourself where it will show you um 8 * 7 or 8 factorial is basically this this number. Okay. So now in our next example we will be looking at how we can generate Fibonacci numbers. For this example, we will be using bunch of if and else if statements along with a while loop. So let's look at this piece of code where we are actually doing this. So as you can see the first part of the code is basically an input statement asking us how many Fibonacci numbers we would like to generate and then the user would be asked to give an input which is stored as an int into a variable count. Now in this uh if else statement the first uh if statement checks whether what we have entered is zero in which case we just store an empty array in the variable called fib. Next if our uh entered integer is one we just store the value one in this array called fib. If our entered number is two we store one and one in the array fib. All of these are different sets of Fibonacci sequences. This obviously an empty an empty array shows that well there is no numbers to be generated in this sequence. If we have one we just print the first number of the Fibonacci sequence which is one itself. If it is two we print the first two numbers which is 1 and one. Now the actual calculations happen when we say we want a Fibonacci sequence for more than two numbers. Now in that case we move on to this block. In this statement block, we initialize the fib variable with the first two Fibonacci numbers one and one and we store in this v in this array. Now we are going to do a while loop within this. And in this while loop we're going to keep executing this statement block as long as this condition is met or this condition is true. And what this condition is is it's checking this variable i which we have initialized as one over here. And we're going to check whether that is lesser than count minus one. count being the number that we have been asked to input. If the statement is true and as long as the statement is true, we will be executing this statement block which is basically us appending this expression into the array fib. Now what this expression is is basically it's going to keep adding each subsequent numbers and we're going to store each subsequent numbers back into the uh array fib. So in this case if you see the what the first step will do is it will take the value at the first position of the array fib and it will add it to the value at the zero position of the array fib and both of these values since they are 1 and 1 when we add them we get two and we append that to fib. So now our fib will look like 1 comma 1 comma 2. Then we increment this by one and what we do is we uh do the same process again. So in the next step what would be what we would do is we would do 2 + 1. So we would get three. Now this would keep going on until this condition is met or basically until uh the numbers that we actually want to generate in our sequence. So let's like let's let's uh execute this and uh let's see an example of what happens. So it asks me how many Fibonacci numbers I would like to generate and I will say I want the first let's say six Fibonacci numbers. So I execute this. As you can see, this gives me the first six numbers in the sequence, which is 1 and 1, and then 2, which is basically 1 + 1, and then three, which is 1 + 2, and then 5, which is 2 + 3, 8, which is 3 + 5. So, if we wanted more numbers, we would just enter over here. Like, say if we wanted the first 10 numbers, it would give us the first 10 numbers in the sequence as you can see here. Now in our next example, what we are going to do is we're going to write a program which takes two digits that represent the dimensions of an array. For example, if we want a 3x3 array, we will enter 3, 3. And we are going to generate a two-dimensional array in which each of the elements of the array are basically the row times the column position of that particular element. And what I mean by this is say we have a position i, j on the array. The value of the uh element at that position would be i * j. So for example, if I'm looking at something at the third row and the fifth column or say the third row and the third column, for example, the value of the element would be 3 * 3. And if I'm looking at something at the second row and the fourth column, I am going to do 2 * 4. So let's uh let's see how we can do this using code. So if you look to the right over here, I have a piece of code where I'm going to uh in where it asks me to input two numbers, two integers to represent the dimensions of my uh example my sample array. Now once we have done this, we are going to store these um these uh uh dimensions in the inputs uh in in a variable called input string. So obviously when we enter say 5a 5 that will be stored as an int in this particular string or this variable what we want is we want uh five say we enter 5a 5 we want five as a separate integer and the other five as another separate integer and that is what we do in this particular statement where we're going to split up our input string uh based on the comma separator and we're going to store the first part of that string into the zero position of dimensions which is an array. and the uh next dimension in the first position in this uh particular array. Now we're going to store the number of uh rows as row number and that is the zero position of this array and we're going to store the number of columns as the first position of dimensions or whatever we've mentioned in the input. So now we uh we have this um our results array called multilist which is basically what what our final array is going to look like and we're going to store into multilist and uh in this example we will be using for loops to uh do this or to create this particular array. So as you can see here our first uh we have initialized our multilelist saying that um we're going to have only zeros in our sample array. So initially once we have initialized this array all multi-lists will contain is a say for example we have inputed a 5x5 array it will have basically a 5x5 array with all elements as zero and that's what this line does. Once we have done this we are going to move on to the for loop portion where we actually going to create our uh array that we want. So as you can see we are our first for loop is going to say for row in range row number. So obviously uh range will generate a uh an iterator which can be iterated over um and since it says range row number and say our the number of rows that we entered were five. What it's going to do is it's going to create an iterator containing the value 0 1 2 3 and four. So for row and range it will basically basically row will take the value 0 1 2 3 and four. And a similar thing is going to happen in this nested for loop which is within this where we're going to again uh create a an iterator using this range function and for the column number. Once we have this we're going to do the simple process of um multiplying the u the value of the element based on its position. So if it's at the position 3, 4, we're going to store the value 3 * 4 into that particular position of the array. And we're going to do this for every position which is what happens in these two for loops. We're going to first go by uh each row and then within that we're going to check each column and we're going to perform these calculations. And finally we print our result. So let's look at an example. Now I'm going to say I want a 3x let's say a 2x4 matrix. So let's see what the results will be when I give this as. So what I'm saying is I want two rows and four columns. Now as you can see here, it might not be very clear to you right now, but what you can see here is this is the first row and this is the second row and each row contains four columns. So these are the this is the my final array that I get. So what you can see here is this is the zero position and the uh or you can say this is the first row, first column, first row, second column and uh since Python is zero based so this is actually the zeroth row and this is the first row. So as you can see uh this this value basically is 0 * 1 this value is 0 * 2 0 * 3 0 * 4 and over here it is 1 * 0 1 * 1 1 * 2 1 * 3 so similarly if I did for example a 5x 5 matrix what you will get is five rows now five rows and five columns and for example like this particular value is uh 1 2 3 or 0 1 2 3 so 0 1 2 3 and the first column column. So this is 3 * 1. Um if I took this value, this is like the fourth row. For example, fourth row time the um 0 1 2 3 third column. So this would be 4 * 3 which is 12. So and each value of this has been generated in the similar process. So this is an example of how we can use for loops um for a particular exercise that I have shown you right now. In this video we will be covering the topic of definite iterations uh using for loops in Python. So starting off we know that there are two types of iterations in programming definite and indefinite. We have already covered indefinite iterations in the form of while loops. Definite iterations on the other hand are done using the keyword for uh and the basic syntax or the standard syntax for a basic for loop in Python is as you can see over here we have this for keyword. we have some variable, we have the in keyword and we have this iterable and we of course define this control structure with a colon and then indented we have this uh statement block. So once this for loop has started we execute all of these uh statements within the statement block as part of the for loop iteration. So yeah let's uh now let's to understand like how for loops work uh exactly let's uh look at the concept or meaning behind what we call iterables and iterators. So, so think of it in a step-wise manner. All right. So, we in Python, we have different objects that can be used as iterables. And an iterable is basically some object that uh it's it's a collection of other objects. So, you know, think of your lists, uh think of dictionaries and sets. So, all of these are essentially collections of objects. So, once we have these collection of objects, uh we can create an iterator out of it. uh how do we do that is we use the iter function. So for example, if I passed this list A, if I pass this list A through the iter function and I store it in some variable iter A um and I see what is it A, it is actually a list iterator at some random memory location which we don't really care about. Similarly, if I gave a tupil and I did the same thing, I will create a tupil iterator. And uh in the left if you can see over here I've done the exact same uh functions with sets and dictionaries as well. So I'm creating iterators out of these uh iterables so as to speak. Uh now what is an iterator? Well, an iterator is an object that yields values successively. So if my list contained five values or five objects, an iterator of this list will yield these values one after the other. And that is kind of how or that is the basis for which we do uh we create loops. Let's see what we exactly mean using this uh using another function that we call the next function. So the next function keeps moving from object to object within an iterator. So since I've created this list iterator, let's just do it once again. So as you can see, I've created this list iterator item a. Now with this iter a, what I'm going to do is I'm going to use this next function. What next function does is starting from the leftmost object within this iterator, I will keep yielding or I keep producing the values. So let's let's just see what happens when I do next iter when I do next for this particular variable. It gives me this object first. Now let's see what happens when I do it again. Now it gives me the object second. What if I did it again? It gives me third. Now if I kept doing this, it would keep giving me the different objects that were initially stored in a that is first and then second, third, fourth and fifth one after the other. So let's actually perform that. Now I get fourth. Now I get fifth. Now a natural question is now that I've exhausted all of these values, what will happen if I perform the next function again? Well, let's see what happens. I get a uh an error or and this error is the stop iteration function error which basically is telling me look you have exhausted all of the objects that were initially present in this list A and you cannot you cannot keep doing the next next function anymore you cannot go keep going further so yeah so this is uh what the next function does when it comes to the concept of iterators all right so now we've learned two things what is an iterator and what is the how do we create an iterator out of different collections of objects like a list or a pupil and we've also learned how to use the next function. Now let's uh move or let's come back to our for loop that we uh started off this uh video with. So our for loop again let's consider our for loop over here. As you can see some for loop with the objects again 1 2 3 4 and 5. All right this is a list. Now I'm going to do for x in a print x and let's try to see what happens when we do this. Okay, as you can see when I have executed this it gives me 1 2 3 4 and 5. So I have first of all let's look at this for loop. I in this for loop I define a new variable x and then I say for x in a print x and what's happening? Well in each iteration I'm printing whatever the value of x is uh at present. So in the first iteration it is the first object one. In the second iteration it is the second object two. Then 3 4 5 and then finally on its own like uh this for loop knows that okay now once I have exhausted all of the objects within my iterator I can stop doing this for loop and I can move on with the rest of the code. All right. So think of it like a three-step process. Uh a for loop in Python. The first step is it calls an iter function to obtain an iterator for whatever we pass over here this iterable. Second step it calls the next function repeatedly in each iteration. All right to keep getting the next item from the iterator. So it gets one and then it calls next. Then it gets two then it calls next and it gets three and then four and then five and so on. And then finally the third step is the termination step is when after we do the final next where we get this uh error as you can see the stop iteration error or exception. Finally this tells the for loop function or the for loop that um okay we have reached the end of our definite iteration or the end of our definite for loop and this is where we must terminate our loop and then continue with the rest of the code. All right. So this is how a for loop works in Python. Now it's very important to note that whatever we have discussed when it came to while loops such as nesting of while loops and nesting of other control structures is also applicable in the case of for loops. So if I had a for loop within another for loop that is perfectly fine. If I had a while within a for loop that is perfectly fine. So all of these are valid statement blocks that we can do. uh and again for loop is another control structure and so we must follow the concept of uh indentation when it comes to writing our statement blocks within a for loop. Okay. So now I'm going to speak about in specific I'm going to speak about the this uh something called the range function that is uh quite you could say it's used definitely it's used in other areas of programming but it's widely used in Python uh I and uh I mean the for loop in Python. Now what I mean by this is that um range this range function is very important for the for loop and we will see why. Okay. So let's look at um one of the examples of using the range function. So what does a range function do is if I give range five, let's see what it does. It gives me range 0 to 5. What this basically tells me is that this will create an iterator that contains uh integers from 0 to 5. So it will contain the object 0 1 2 3 4 and 5. And we can use this as an iterator. So let's let's look at this. Uh I have range five. Uh let's store this in x. Okay. Now let's do a type just to see what happens when we do type x. It should give me the type of range as you can see. And this is a type of an iterator in Python. Now let's see what happens when I do for i in x print i. Okay, let's see what happens. As you can see, it prints the number 0 1 2 3 4. An important caveat when it comes to the range function is when we say range five, it creates an iterator from 0 to 5, but it contains the objects 0 1 2 3 and four only. it does not contain the object five itself. Okay, this is something that is very important to so uh once again I created uh I use this range function to create an iterator from iterator of five objects from 0 to 4 0 1 2 3 and 4. Uh I use that in my for loop and uh that is what that is what you are seeing here. Now let's use this range function in the context of something else. For example, let's see. So I had my earlier list A, right? Look at my list A here. So you can see list A contains these 1 2 3 4 5 objects. Okay. Let's see what length of A is. Length of A is five. Okay. Uh let's use the range function on top of the length of this list A. And this is uh like I can't show you an example right now without any context. But this uh this form of using a for loop is used is widely used in uh Python programming. You will use it so much in data science. you will use so much in machine learning and AI. I cannot tell you. Uh this is so this is a very important like sort of uh for loop expression. So you have four let's say I in range len a let's see what's going on here. First I create uh first I do length of a that gives me five then I do range of five that creates an iterator between uh 0 and four right when you do range five it gives you an iterator of 0 1 2 3 and four as we saw earlier. And this is what we're doing over here. We have created an iterator out of the length of a list. Now when I do print I, it should give me again 1 2 3 4 0 1 2 3 4 of course. So as you can see here, it will give me 0 1 2 3 4. And this is a very neat way of using the range function on top of the length of a particular collection of objects. In this case, we're using the list a. This is something that you will use a lot. So I I I would recommend that you get used to this form of creating a for loop as well using the range function. Also of course um there are uh the you can use break and continue statements as you have in the case of while loops. Uh exactly this it works exactly the same in the case of for loops wherein the break statement will abruptly stop the for loop completely and we will move on to the next piece of code. Whereas a continue statement will break that particular iteration and then we will uh resume with the next iteration. So yeah that was break and continue statements and for loops. Uh finally I would like to show you something about uh how to use dictionaries as an iterator or as an iterable when it comes to for loops. So let's create our dictionary. Let's go. We have a dictionary already here. In fact create this dictionary again. We'll store it in a. Okay. So I created this dictionary A. All right. So I have dictionary A. Uh what I'm going to do is I'm going to pass it through the iter function as you can see. And now I'm going to just for the sake of showing you it will show I'll show you that it is actually an iterator of type of a specific dict key iterator type. All right. So now let's uh let's do something on this. So as you can see in this dictionary I have the key first that has a value one. I have the key second that has a value two. I have the key third that has a value three and then fourth for four. Fifth for five. Now a good question would be when I do iteration or when I do a for loop on top of this a well what is it going to pick up? Is it going to pick up first is it going to pick up the keys like these or is it going to pick up the values or is it going to go one by one key and then value and then key and the subsequent value. Uh let's see what actually happens. So let's do for i in uh iter a print i. Let's see what what is the iterations happening upon using this. So as you can see we're using the keys. So by default when we do this when we perform when we create an iterator out of a dictionary we use only the keys as our uh uh iterator elements or iterator values. But of course like if you wanted to use values all you would have to do is pass a dot values over here. And if you remember from a dictionary video, this uh a dot values gives us a a list of or it it gives us the essentially a list of the values in our dictionary. So when we pass this to the iterator uh iter function and we create an iterator out of it. Let's see what happens over here. Now let's see what is it a. You can actually see it's now the dict value iterator at a particular memory location. So it's not the dict key as we saw earlier. where it's a dict value iterator. So now that we have this dict dictionary value iterator, now let's print what are our iterator elements. And as you can see now we are printing values and not um the keys. So this is how to the this is basically two different ways of iterating through a dictionary. One through keys and one through values. In this video we will be doing a small exercise on if statements. Now in the previous video you might have already seen some of the basic concepts surrounding if statements. However in this video just to drive home the point or the purpose of an if statement we will be doing a small exercise. So let's first revise some of the concepts of an if statement. So a basic if statement can be something like this. We have a small condition where we're checking if a variable x is greater than five or not. And if it is greater than x we print a statement over here. So if this condition is met we print this statement else we move to the statement block. Now our variable x has a value five. Now since x is not greater than five what this will do is it will check the statement and since this will be false we skip the statement block and move on to this statement. So as you can see here similarly we can do something uh where we are checking multiple statements we use the l if statement in such a case. So now in this block we are checking in one of the one of the conditions we're checking is if x is equal to 5 or if x is greater than 5 and then finally if both of these conditions are not met we say else and we print whatever or we do whatever is in this particular statement block which is a simple print statement. So as you can see x is indeed get is equal to 5. So this is the block that will get executed as you can see here. Now another example are nested if statements. So nested if else statements are if else statements within if else statements. So let's look at an example. As you can see here we have a string stored in a variable called orange quality and the string is fresh. Now we have an integer or a float in this case 4.0 stored in orange price. Now our first statement is checking whether orange quality the variable orange quality is it equal to the string fresh. Now within that if the statement or if this condition is met we do another check where we're checking what is a price is it lesser than five if it is we do this block else we execute this block finally if our initial uh statement or initial condition is not met we move on to this else block now when I execute this what should happen is I will enter this block because this is true and finally I will enter this block because this condition is also true so I should have this printed I will buy five dozens as you can see here. Now let's move on to our main exercise for this video. So this was all just revision. Now we're going to use some or all of these concepts in a sample project or a sample exercise uh to for your further practice. So in this exercise what we're going to do is we're going to request the user to enter a number between 1 and 20. And our u our code is going to check whether this number entered is an even number or an odd number. So as you can see there are two sets of checks that we're going to do in this code. The first check is going to be whether the number that is entered is between 1 and 20 or not. And if it is not we have to say it's an invalid number. But if it is entered between 1 and 20 we have to move on to the further checks which is whether it is an even or an odd number. So let's see how we do that. So in this piece of code, what we start with is a print statement saying, "Please enter a number between 1 and 20." And then we add an input command. This input command will open a box where we can enter whatever number that we want to enter. Now we use this int keyword to make sure that whatever we have entered into the input box is stored as a int data type in the enter num variable. Once we do that, our first if statement is going to check whether the entered number is greater than or equal to 1 or less than equal to 20. Uh sorry and less than equal to 20. So both of these conditions have to be met. If this condition is true, then we have a valid input and this statement is printed that we have entered a valid number. And then we move on to the rest of the statement block within this if statement which is another set of if and else if statements. If our number is not between 120, we move to this block and this block prints that we have entered an invalid number. Now once we have say entered a valid number, we move on to this block. This if uh if else uh if l if statement block. Now what this block is checking is whether the entered number is an even number or not. Now as we know an even number is divisible by two and leaves the remainder zero when divided by two. So this is what this check is doing. If this check is true that means our number is even and we get printed that our number is even. The other other check or the other uh if statement is checking whether it's an odd number and that means when we divide by two we should get the remainder one as you can see here and we get printed your number is odd. So let's execute this and see what happens when we enter a number. Now it's asking me to enter a number. Let's say I enter 17. Now that I have entered 17, as you can see, it's a valid number that I have entered and the code is telling me that my number is indeed odd. Let's look at some other what if I entered

Original Description

🔥IIT Delhi - Data Analytics, Generative AI And Adaptive System - https://www.simplilearn.com/ihfc-iitd-data-analytics-genai-course?utm_campaign=nFzYvA01Bbw&utm_medium=Lives&utm_source=Youtube 🔥Professional Certificate in Data Science and Generative AI - https://www.simplilearn.com/iitk-professional-certificate-course-data-analytics?utm_campaign=nFzYvA01Bbw&utm_medium=Lives&utm_source=Youtube 🔥IIT Kanpur - Professional Certificate Course in Data Analytics and Generative AI - https://www.simplilearn.com/iitg-generative-ai-data-analytics-program?utm_campaign=nFzYvA01Bbw&utm_medium=Lives&utm_source=Youtube This Python Full Course 2026 by Simplilearn begins with an introduction to Python, setting the stage for why it's a powerful and popular language in today's tech industry. This Python Full Course 2026 is designed to take you from beginner to advanced level in a step-by-step manner. You’ll start by understanding what Python is, how to install it, and write your first program. The course then explores core concepts like variables, data types, strings, lists, dictionaries, and control statements. You'll also learn loops, functions, file handling, and Object-Oriented Programming. Advanced topics like polymorphism, list comprehensions, and REST APIs are covered. Hands-on projects in EDA and web scraping enhance practical skills. The course ends with top project ideas and interview questions to prepare you for real-world roles. The Python For Data Analytics Full Course video covers the following topics. 00:00:00 Introduction to Python Full Course 2026 00:17:22 What Is Python 00:23:52 How to Install Python 00:43:44 First Python Program 00:58:38 Variables and Expressions in Python 01:08:07 Objects in Python 01:12:43 Type Conversion in Python 01:21:48 Strings in Python 01:36:26 Escape Sequence in Python 01:39:51 Lists in Python 01:54:00 Tuples in Python 01:59:29 Dictionaries in Python 02:16:40 Arithmetic Operations in Python 02:28:10 Math Function in Python 02:52:25 Con
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Simplilearn · Simplilearn · 43 of 60

1 Ethical Hacking Full Course 2026 | Ethical Hacking Course for Beginners | Simplilearn
Ethical Hacking Full Course 2026 | Ethical Hacking Course for Beginners | Simplilearn
Simplilearn
2 AWS Full Course 2026 | AWS Cloud Computing Tutorial for Beginners | AWS Training | Simplilearn
AWS Full Course 2026 | AWS Cloud Computing Tutorial for Beginners | AWS Training | Simplilearn
Simplilearn
3 Data Structures And Algorithms Full Course | Data Structures and Algorithms Tutorial | Simplilearn
Data Structures And Algorithms Full Course | Data Structures and Algorithms Tutorial | Simplilearn
Simplilearn
4 SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
Simplilearn
5 Microsoft Azure Full Course 2026  | Azure Tutorial for Beginners | Azure Training | Simplilearn
Microsoft Azure Full Course 2026 | Azure Tutorial for Beginners | Azure Training | Simplilearn
Simplilearn
6 Shopify Tutorial For Beginners 2026 | Shopify Course | shopify dropshipping | Simplilearn
Shopify Tutorial For Beginners 2026 | Shopify Course | shopify dropshipping | Simplilearn
Simplilearn
7 Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
8 🔥Feeling Stuck? How Upskilling Can Boost Your Career! #shorts #simplilearn
🔥Feeling Stuck? How Upskilling Can Boost Your Career! #shorts #simplilearn
Simplilearn
9 Growth Hacking In Marketing | Learn Growth Hacking Marketing Strategies | Simplilearn
Growth Hacking In Marketing | Learn Growth Hacking Marketing Strategies | Simplilearn
Simplilearn
10 🔥Cracked 3 Job Offers with One AIML Course! | 20–30% Salary Hike #shorts #simplilearn
🔥Cracked 3 Job Offers with One AIML Course! | 20–30% Salary Hike #shorts #simplilearn
Simplilearn
11 Top 10 Must-Have Figma Plugins for UI/UX Designers in 2026 | Figma Plugins | Simplilearn
Top 10 Must-Have Figma Plugins for UI/UX Designers in 2026 | Figma Plugins | Simplilearn
Simplilearn
12 Business Analytics Full Course 2026 | Business Analytics Tutorial For Beginners | Simplilearn
Business Analytics Full Course 2026 | Business Analytics Tutorial For Beginners | Simplilearn
Simplilearn
13 Simplilearn Reviews | Getting future-ready with course in Artificial Intelligence | Roopam’s story
Simplilearn Reviews | Getting future-ready with course in Artificial Intelligence | Roopam’s story
Simplilearn
14 Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
15 Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
16 Simplilearn Reviews | How David Went From Seasoned Engineer to AI Innovator #GetCertifiedGetAhead
Simplilearn Reviews | How David Went From Seasoned Engineer to AI Innovator #GetCertifiedGetAhead
Simplilearn
17 Complete Social Media Marketing Strategy for 2026 | Social Media Marketing Strategy | Simplilearn
Complete Social Media Marketing Strategy for 2026 | Social Media Marketing Strategy | Simplilearn
Simplilearn
18 🔥Top 4 Cybersecurity Certifications You Need! #simplilearn #shorts
🔥Top 4 Cybersecurity Certifications You Need! #simplilearn #shorts
Simplilearn
19 🔥Cloud Engineer Salary in India 2026 | City-Wise Breakdown #shorts #simplilearn
🔥Cloud Engineer Salary in India 2026 | City-Wise Breakdown #shorts #simplilearn
Simplilearn
20 Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Simplilearn
21 Full Stack Java Developer Course | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Full Stack Java Developer Course | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
22 Social Media Marketing Full Course | Social Media Marketing Tutorial For Beginners | Simplilearn
Social Media Marketing Full Course | Social Media Marketing Tutorial For Beginners | Simplilearn
Simplilearn
23 How To Create LLM Chatbot Demo 2026 | Build a LLM Chatbot From Scratch | Simplilearn
How To Create LLM Chatbot Demo 2026 | Build a LLM Chatbot From Scratch | Simplilearn
Simplilearn
24 Digital Supply Chain Management Certification | Supply Chain Management Course | Simplilearn
Digital Supply Chain Management Certification | Supply Chain Management Course | Simplilearn
Simplilearn
25 AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
Simplilearn
26 ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
Simplilearn
27 Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
28 ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
ITIL Full Course 2026 | ITIL 4 Foundation Course | ITIL Tutorial For Beginners | Simplilearn
Simplilearn
29 Simplilearn Reviews | Integrating AI & Music | Diego's Story
Simplilearn Reviews | Integrating AI & Music | Diego's Story
Simplilearn
30 Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Digital Marketing Full Course 2026 | Digital Marketing Tutorial For Beginners | Simplilearn
Simplilearn
31 SEO Full Course 2026 | SEO Tutorial for Beginners | SEO Training | SEO Explained | Simplilearn
SEO Full Course 2026 | SEO Tutorial for Beginners | SEO Training | SEO Explained | Simplilearn
Simplilearn
32 PMP Vs CAPM: Which Certification Should You Choose? | PMP Vs CAPM | Simplilearn
PMP Vs CAPM: Which Certification Should You Choose? | PMP Vs CAPM | Simplilearn
Simplilearn
33 Complete Data Analyst Roadmap 2026 | How To Become A Data Analayst In 2026 | Simplilearn
Complete Data Analyst Roadmap 2026 | How To Become A Data Analayst In 2026 | Simplilearn
Simplilearn
34 Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
35 🔥5 Jobs That Are Most Likely Safe from Layoffs in Today’s Market #shorts #simplilearn
🔥5 Jobs That Are Most Likely Safe from Layoffs in Today’s Market #shorts #simplilearn
Simplilearn
36 🔥Git vs GitHub – What's the Difference?
🔥Git vs GitHub – What's the Difference?
Simplilearn
37 What Goes Behind Building the Likes of Uber and Netflix? | Product Management Tutorial | Simplilearn
What Goes Behind Building the Likes of Uber and Netflix? | Product Management Tutorial | Simplilearn
Simplilearn
38 AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
AI Agents Full Course 2026 | AI Agents Tutorial for Beginners | How to Build AI Agents | Simplilearn
Simplilearn
39 Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Full Stack Developer Course 2026 | Full Stack Java Developer Tutorial for Beginners | Simplilearn
Simplilearn
40 Product Life Cycle 2025 | Stages Of Product Life Cycle | Product Life Cycle Tutorial | Simplilearn
Product Life Cycle 2025 | Stages Of Product Life Cycle | Product Life Cycle Tutorial | Simplilearn
Simplilearn
41 Project Management Full Course 2026 | Project Management Tutorial | PMP Course | Simplilearn
Project Management Full Course 2026 | Project Management Tutorial | PMP Course | Simplilearn
Simplilearn
42 PCB Design Course 2025 | PCB Designing Explained | How To Make PCBs | 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
Python Full Course 2026 | Python Data Analytics Tutorial For Beginners | Simplilearn
Simplilearn
44 🔥Top Product Management Skills You Need to Succeed in 2026 #shorts #simplilearn
🔥Top Product Management Skills You Need to Succeed in 2026 #shorts #simplilearn
Simplilearn
45 SQL For Data Analytics 2026 | Essential SQL Commands | SQL Tutorial For Beginners | Simplilearn
SQL For Data Analytics 2026 | Essential SQL Commands | SQL Tutorial For Beginners | Simplilearn
Simplilearn
46 Simplilearn Reviews | Paving Way To Success With AI & ML Course | Soumik’s Upskilling Journey
Simplilearn Reviews | Paving Way To Success With AI & ML Course | Soumik’s Upskilling Journey
Simplilearn
47 Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
48 Learn Snowflake In 45 Mins | Snowflake Tutorial | What Is Snowflake | Snowflake Explained
Learn Snowflake In 45 Mins | Snowflake Tutorial | What Is Snowflake | Snowflake Explained
Simplilearn
49 🔥ML Career Tip – How to Start Learning Machine Learning in 60 Seconds! #shorts#simplilearn
🔥ML Career Tip – How to Start Learning Machine Learning in 60 Seconds! #shorts#simplilearn
Simplilearn
50 🔥Agile vs Waterfall in 60 Seconds #shorts #simplilearn
🔥Agile vs Waterfall in 60 Seconds #shorts #simplilearn
Simplilearn
51 Excel Full Course 2026 | Excel Tutorial For Beginners | Microsoft Excel Course | Simplilearn
Excel Full Course 2026 | Excel Tutorial For Beginners | Microsoft Excel Course | Simplilearn
Simplilearn
52 What Are AI Agents? | Types Of AI Agents | AI Agents Explained | AI Agents Tutorial | Simplilearn
What Are AI Agents? | Types Of AI Agents | AI Agents Explained | AI Agents Tutorial | Simplilearn
Simplilearn
53 How To Create a Product Roadmap In 2026 | Product Roadmap | What Is Product Roadmap | Simplilearn
How To Create a Product Roadmap In 2026 | Product Roadmap | What Is Product Roadmap | Simplilearn
Simplilearn
54 SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
SQL Full Course 2026 | SQL Tutorial for Beginners | SQL Beginner to Advanced Training | Simplilearn
Simplilearn
55 🔥What Is Phishing? #shorts #simplilearn
🔥What Is Phishing? #shorts #simplilearn
Simplilearn
56 Cloud Computing Full Course 2026 | Cloud Computing Tutorial | Cloud Computing Course | Simplilearn
Cloud Computing Full Course 2026 | Cloud Computing Tutorial | Cloud Computing Course | Simplilearn
Simplilearn
57 Simplilearn Reviews | Overcoming Rejection & career plateau to finding a New Job : Bhaskar Banerji
Simplilearn Reviews | Overcoming Rejection & career plateau to finding a New Job : Bhaskar Banerji
Simplilearn
58 Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Six Sigma Full Course 2026 | Six Sigma Green Belt Training | Six Sigma Training | Simplilearn
Simplilearn
59 Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Generative AI Full Course 2026 | Gen AI Tutorial for Beginners | Gen AI Explained | Simplilearn
Simplilearn
60 VLSI Design Course 2026 | VLSI Tutorial For Beginners | VLSI Physical Design | Simplilearn
VLSI Design Course 2026 | VLSI Tutorial For Beginners | VLSI Physical Design | Simplilearn
Simplilearn

This video teaches the basics of Python programming and its applications in data analysis, providing a comprehensive introduction to data analytics with Python. The course covers data cleaning, visualization, and machine learning, and provides a thorough understanding of Python and its libraries.

Key Takeaways
  1. Install Python and necessary libraries
  2. Learn basic Python syntax and data structures
  3. Work with Pandas for data manipulation and analysis
  4. Use Matplotlib for data visualization
  5. Apply machine learning concepts to data analysis
💡 Python is a powerful language for data analysis, and its libraries, such as Pandas and Matplotlib, provide efficient and effective tools for data manipulation and visualization.

Related Reads

📰
Decoding Workforce Dynamics: An In-Depth HR Analytics & EDA Case Study
Learn how to apply HR analytics and exploratory data analysis to decode workforce dynamics and make data-driven decisions
Medium · Python
📰
Kestra vs dbt: Which Data Tool Should You Choose
Learn how to choose between Kestra and dbt for your data needs, and understand their key differences and use cases
Medium · Data Science
📰
How to Build a Clean Earthquake Dataset from the USGS Catalog (No API Key Required)
Learn to build a clean earthquake dataset from the USGS catalog without an API key, and discover the value of publicly available seismic data
Medium · Data Science
📰
How to Build an Hourly Air-Quality Time Series (Without an API Key)
Learn to build an hourly air-quality time series without an API key for data science projects
Medium · Data Science

Chapters (15)

Introduction to Python Full Course 2026
17:22 What Is Python
23:52 How to Install Python
43:44 First Python Program
58:38 Variables and Expressions in Python
1:08:07 Objects in Python
1:12:43 Type Conversion in Python
1:21:48 Strings in Python
1:36:26 Escape Sequence in Python
1:39:51 Lists in Python
1:54:00 Tuples in Python
1:59:29 Dictionaries in Python
2:16:40 Arithmetic Operations in Python
2:28:10 Math Function in Python
2:52:25 Con
Up next
The Test Is Right 99% of the Time
DataMListic
Watch →