Python for Beginners: Python Programming Masterclass in 2025 | Kovid Panthy | Skillshare
Search

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Python for Beginners: Python Programming Masterclass in 2025

teacher avatar Kovid Panthy, Corporate Trainer - Impact Yes, LLC

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      3:01

    • 2.

      Understanding Computer Programming

      7:56

    • 3.

      Logic vs Syntax

      5:40

    • 4.

      Software Development Life Cycle

      7:49

    • 5.

      Python Installation in the System

      4:29

    • 6.

      PyCharm Installation in the System

      10:46

    • 7.

      Writing Your First Program

      6:10

    • 8.

      Data Types in Python

      6:58

    • 9.

      Integers and Float

      4:19

    • 10.

      Strings and Boolean

      5:34

    • 11.

      List Data Type

      5:06

    • 12.

      Dictionary, Tuple, and Set

      6:51

    • 13.

      String Methods

      22:09

    • 14.

      List Methods

      17:37

    • 15.

      CRUD

      5:50

    • 16.

      Dictionary Methods

      12:27

    • 17.

      Tuple

      8:11

    • 18.

      Sets

      5:25

    • 19.

      Arithmetic Operators

      8:20

    • 20.

      Assignment Operators

      2:36

    • 21.

      Comparison Operators

      6:28

    • 22.

      Logical Operators

      14:19

    • 23.

      Conditional Statements

      18:55

    • 24.

      For Loop

      22:25

    • 25.

      While Loop

      17:23

    • 26.

      Break and Continue

      12:26

    • 27.

      Exception Handling

      11:17

    • 28.

      Function

      10:33

    • 29.

      Arguments

      6:53

    • 30.

      Return

      8:02

    • 31.

      Recursion

      18:55

    • 32.

      Object Oriented Programming

      9:22

    • 33.

      Project 1 - ConsumerReports Website

      26:11

    • 34.

      Project 2 - Craigslist Website

      12:06

    • 35.

      Stock Analysis using Pandas and API

      33:05

    • 36.

      Final Remarks

      4:35

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

281

Students

2

Projects

About This Class

This is a beginner to expert Python programming learning track. You can elevate your knowledge in Python Programming for beginners by diving into this course and practicing accordingly.

In this Python Programming course:

  • We'll start with installing Python and some Python basics.
  • All Python data types and built-in methods in depth.
  • User-defined functions, various parameter passing techniques, and object-oriented Python programming concepts.
  • Main Python programming concepts such as list comprehension, map functions, filter functions, generators, iterators, and itertools.
  • It also covers web scraping with beautifulSoup, requests, and web development basics.

Once you get here, you can start a new journey to learn domain-specific Python libraries like NumPy, Pandas, Matplotlib, Scikit-learn, TensorFlow, and Keras for machine learning. Django, Flask for web development. PySpark for big data processing and much more...

By the end of the course, you will be able to confidently apply for jobs in Python programming with the right skills you will learn in this course.

Here's what some students have told us about the Python programming course after going through it

"Great service, fast response time, incredible mind, very informative. Walked me through all the steps of my program and why what things go where. Answered all my questions in a friendly way. I will definitely be back for more programming help!" ~ seanpat191

"Got the first class, communicated very good, explained very well the things he was showing me . and i feel good about Kovid teaching me more in the future." ~ Mikey Chiltren

"It was my first session yet I enjoyed it and found it very useful"- Shomou Khsabaa

"He is really good in his field and an amazing person. when getting lessons it is important to understand the content and at the same time like the way the teacher teach. Kovid Panthy is both like able and has a good ability to teach others. I will use him til the day I die!" ~ Abila Sabbi

"Kovid Panthy was extremely helpful with his extremely long background of coding. Me, as a intermediate programmer, he was able to explain, help, provide insight into my issues, and come to definite conclusions. If there is anyone you are going to get help from, this is the guy B)!"~ Anonymous User

"Excellent teacher! He goes at your own pace and will stop and test you on what he just taught to make sure it’s making sense. He teaches you not only the syntax of languages but also gives a background of why things are the way they are which helps reinforce concepts. I’m definitely signing up for more lessons. Thank you!" ~ Tech Matlock

And many more...


Why take a Python programming course?

Python is a high-level interpreted, object-oriented programming language. Python is an open-source programming language with more than 1 million libraries and more than 100,000 active contributors.
Python is also known for its simplicity compared to other programming languages.

Whether it's artificial intelligence, web development, IoT, Big Data analytics, cloud application development, or automation, there are countless use cases for Python.

Python is the language of choice for machine learning, data science, and artificial intelligence. To get these high-paying jobs, you need expert Python knowledge, and that's exactly what you'll learn in this course.

Meet Your Teacher

Teacher Profile Image

Kovid Panthy

Corporate Trainer - Impact Yes, LLC

Teacher

I am a Soft Skills Corporate Trainer and a Tech Enthusiast. I started my journey with technology and combined it with Marketing. Currently, we train 5-star luxury hotels with training programs for luxury strategy. I also provide consulting sessions on Marketing and Brand Strategy to businesses. I am happy to see you want to learn something here. Here are some of my courses below.

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: Panther, your instructor for this whole course. In this course you will be basically getting to understand programming. Now, by programming, I don't mean general programming only. I mean all the details about programming, including the basic ones. In particular, we'll be learning Python programming in this whole course. And we'll be looking at some techniques and strategies of how you can implement the things that you learn will be using practice questions so that you can practice on the goal in this course. Whenever we talk about programming, I think it's important for you to understand that programming is all about logics. So this video or this course is not particularly for people who want to just not put into practice, because logic is all about practice. You build up logic, you build up neural networks, your brain, using practice, you train your brain more and more to understand certain concepts in programming. It's also the same. We'll be talking about concepts. We'll be looking at the practical examples. But unless and until you implement those into the real-world practice, it's not going to make difference, right? So I want you to practice and put into practice, separate some few hours in a day for this particular course. If something is not understandable, I want you to repeat the session or lesson to understand it even more in detail. And what you can expect from this course is to have a hands-on experience and Biden programming. Once you complete this course. I think if you put in the practice, if you go along with the journey, you will be able to call yourself a Python developer, because all the basic concepts we have already covered even we go little bit into the advanced as well, right? So what I want you to do is separate a pen and paper for notes, separate few hours in a day, like maybe 23 hours, if possible. If possible, maybe 67 hours or as well. But if not possible in at least one hour a day, right, so that you keep up that consistency. See Bruce Lee one said, I fear a man who kicks one kick a thousand times, not the man who kicks thousand kick one times, right? So it's all about consistency, right? The more you keep in the work, the more consistently you do the practice, the better you get at it. So this scores can be taken by any of the people, any people without prior knowledge of programming or with prior knowledge of programming, doesn't matter. Here we'll be looking from the very basic to variate bunch, right? So that's it for me. In this introduction video. We'll be starting with understanding the programming and then will be slowly moving into Python. I'll see you in the course. 2. Understanding Computer Programming: So welcome to this very first tutorial that we have been studying. Congratulations again for joining us. So in this video, we'll be digging deep into the principles of computer programming and trying to understand what programming is really. And how you can actually go deeper into programming. Some of the programming concepts that might help you in future and for the betterment of learning experience that you will acquire. This will also help you in understanding the core concepts of actual programming when you dig deep into Python. Okay, so now let's understand literally what computer mean. So firstly, computers mean by definition, it's a programmable electronic device designed to accept data, perform prescribed and mathematical and logical operations. So what this means for you is computer is a programming machine. So the first very first word is programmable, meaning which can be programmed. Now that's where computer programming comes from. Computer is just a hardware which is topped with the software. So that's how you can understand. Now, let's talk about the concepts and principles that we've been talking about on which program programming and computers rely on. So we call this IPO, or sometimes also I pose Principles of Computing. Now, the very first IF I pose is input. This is where we are computer, takes input from users. The second P in Naples is process. What this does is based on those information that we got in the input is now processed based on our computing. And this will give us, the process will give us the third I pose element, which is output. Alright? So firstly it takes input, then it process it, and then the process gives us an output. And now this output is stored in a stories. So this is the whole concept of computing. If you see any kinds of computer, whether it be mobile, whether it be, you know, Android phone, tablet or whatever it is. All of the digital computing device that you see in this world are in this fundamental principle of computing. This principle dates back to the very first computers that Charles Babbage, the father of computer, created. The IPO. At the time. Obviously stories was not there, but it developed within the time. So basically, let's revise this again. So firstly it takes input, then it processes it, then it gives output. That output is then stored in a storage device. So that's the whole idea. Now, where does actually programming stand? Is it an input part, process part, output part, or store as part? To answer this, obviously, programming is everywhere, even in input two stories, but where the actual programming actually is. Now actually process is programmed. The middle part, the b is process, and B is programmed. Now where this process happens, if you have ever gone into your CPU or your motherboard and just opened it, you might have seen this little chip, sometimes known as microprocessor, or sometimes people call it just Intel I7, I6, I5, whatever it is. Now, this little chip is the thing that handled all the processing of your computer. And this is where your programming actually works. And matter of fact, just to make you understand more, this little device can hold medians of data, millions of data, literally millions of data. Now, the fact here is that this little device is now programmed with a thing called binaries. You might have heard about this 101001, right? These are called binary digits. So computer only accepts 01. What this means for you is d o means off one minutes on. Which means if you have ever seen a switch like your bulbs, which you might have seen, one side is off, one side is on. So that's exactly the principle that binary is walk on. Zillow means of one means on. The sockets are played around with this 01 sequence. That bleeding of circuit creates the instruction to the computer. Isn't it fascinating? It's really fascinating. The computer system is really fascinating. Now, let's understand binary. Can we know? Because binary is the complex, most complex forms used in the earlier versions of computers, even those wedges computing systems, not real computers. There were just mechanical devices. When Lady Gaga starter, which was the First Lady programmer and also a first programming, C was the one who wrote those goods. And obviously the programmers that followed, we don't have to, because these binary codes are now compiled into a form to make it more human understandable and human, so that we and you can write codes. And those are called programming languages. These programming languages have compiler in its back-end, which deals with all those compiling and changing to binary and all those things. We just have to understand how to write the codes for those programming languages. And then we're done. We can create literally anything and everything that we want, ranging from ai, robots to websites, too, complex applications to everything. So in this whole tutorial, as you already know, and as I am the specialists on us, we'll be using Python, which is a massive programming language that is being used worldwide across the globe. We will be using this programming language, this revolutionary programming language, to build up our skill set and to make something meaningful out of it. So I'll see you in the next session where we will be discussing about all the things, especially for other things, specifically on Lasix and syntaxes. So how we can dive into the Python and how programming really works. So before learning, exit actual Python language, we'll be focusing more on the conceptual things so that we can build our foundation on it. I'll be seeing you in the next session. 3. Logic vs Syntax: Next up is logic versus index. Now, what do I mean by logic and what do I mean by syntax? That's what we'll be looking at. We'll be looking at the variations and what is the difference between these two and what is more important in programming when you approach programming in it from here. So imagine this. Imagine that you are in a war. So in a war, what do you think you need? The most important things? The very most important things. One weapon and second strategy is not correct. Because when you go into the water, you need weapon to perform the activity that you are going to. Then you need a proper strategy, the plan to execute. When you go into the water, you can't win the war without a weapon. And you can't win a war without a strategy unit, both of them, right? If you have world-class strategy, but you don't have good weapon. So you can be brought down. If you have great weapons, but then your strategy is weak, then maybe you'll search yourself, right? So you need a combo of both of these. Now what would be a good example? This is the exact example in programming. Think of your weapon as the syntax. The syntax that you are going to learn is your weapon. And the logic that you will create in your program is the strategy. You can't win the war without a weapon and strategy. Similarly, you can't build a software without syntax and logic. You need both of them, a blend of both of them. So you need a blend. So you can just learn syntax. This is what many people do. They just go up programming with this approach of just learning syntax, learn to code, just add, but then they miss out on logic. They miss out on how to write the code and understanding of the whole thing, and then they become a miserable program. And some people I've seen also, they focus more into logic and they don't know how to code it. So that's not make sense also, that would be a mathematical person, not the programmer. So you need a good blend of both of those. By the logic, I don't make mathematic equations. What I mean, I'll tell you in a bit. So what would it be a good blend? What it would be a blend percentage, syntax and logic. I will always put logic in the first place and syntax in the second place. Because if you don't have proper logic, you can't work with programming. You need a proper understanding of the code and proper understanding of the process. So you need a good logic. That's why I put it as 6040 principle. So this is like 60 per cent logic and 40 per cent syntax, that would be a good blend. So when you approach programming, just think about it that whenever you're trying to learn programming, just understand the logic behind it. Don't just focus on syntax and remembering of the syntax, focused on the logical part of it. And what is logic? Now, what do you think is logic? Logic is nothing but logic is problem-solving. Logic is algorithms. Logic is the way to perform the program, right? And it is descriptive understanding of the process. So whenever you are given a problem, the logic is how you solve that problem. When you're trying to write the program. The logic is how you are creating an algorithm of going through the program, the understanding of the program, and ready to perform the program. Now, when you're writing the code, you would want to understand how to perform that program. And finally, it's a descriptive understanding of the process. So if you are, if your program has to go from point a to C, the understanding would be how to go from a to C. Maybe there is a mid point B from a to B and then B2C. So understanding of the whole process is itself logic. Now that being said, that is the logic. Okay? Now what is syntax? Syntax is something that we'll be learning from now on. So the next thing, one thing would be software development life cycle, which we'll be covering. But after that we'll be installing Python and learning Python itself. So that would be the syntax and how you can learn the logic by practicing. The more you practice the things that we discuss in the coming episodes, the more you understand the logic behind it, and the more you get better at the logic part. Syntax, I'll make sure that will be covered by me. But logic, I'll want you to be responsible for that and just practice more and more and more that would make you more efficient in terms of programming. Next up, we have software development lifecycle. So that is what we'll be covering next. And this is the thing about its lifecycle of how software development occurs. And that's what we'll be looking at. I'll be seeing you in the next session. 4. Software Development Life Cycle: Development life cycle. So in this episode, what we'll be talking about is the overall life cycle of how the software is developed. So whatever the keys, like whatever you are doing in web programming or software programming or whatever kind of programming is that you should follow a step-by-step process from start to finish when you develop any program. So that itself, the whole process of creating a software. It can be any kinds of software, is known as software development life cycle. Now, software development lifecycle technically has five parts. Usually people can also call it a sec, six parts. But usually the waterfall model that we're looking at here has five parts. The first of those five is planning second, analysis. Third is designed for this implementation and maintenance. Now, all of these can be considered as one whole process. So firstly, it goes with planning, the analysis and design and implementation and maintenance. Now this overall model is known as waterfall model. So if you go into Google and search for waterfall model of software development lifecycle, which we also call as SDLC. So S for software default development, Alpha life and C4 cycle, or SDLC, software development life cycle, SDLC waterfall model is this. Now there are multiple kinds of model which determine the software development lifecycle as well. So there can be other kinds of models depending upon the use cases and how the programming is developed. But generally and commonly, waterfall model is used. So this can be very useful for you when you are approaching programming. So if you get a project, then you must go through the step-by-step process. Now, first step of this is step one planning. Now in this process, in this step, what you do is basically you try to figure out what the problem actually is. So let's say you're given a problem that you have to create a website, you have to understand the problem. Now. You have to plan the whole process. Now first thing about planning is understanding the problem. So what is it that you have to do? So, for example, you have to create a website. Now. You have to identify what kind of website is it? What is the use of it? What are the functionalities of it? All those things, all those details of what WH questions, right? We say why, what, how, why, and all these things. It comes in planning. So you are basically trying to picture how the program should look like and trying to really figure out what approaches work and what kind of tools you need. So all those come into planning. So step one, planning incorporates all the things that comes before actually calling the problem, right? So that is planning. Now, in this planning, you will have answers to all the problems that you have. You will have answered to what kind of functionality is you have to react to that program. And you will have answered to what kind of algorithms and processes that you will need and approaches that you will need while programming or developing that program. Now the second step is analysis. Now once you have this, ensures, you have to now analyze whether those answers are correct or not. So for example, I have to create a website. Is that correct? Yes. Now, maybe in the planning section I said, Okay, I have to create a website that has a functionality of login. Now I have to really check if I need to login functionality or not. Now, if it is not really login kind of thing, then maybe not declared that. So you are trying to, what you are trying to do in this step to analysis is ranked would really analyze the whole planning process. That's step one. And really see what are the things that you need and what you don't need. So you really walk on those which are really valuable. That is, step two. Step three would be designed. Now here is where you will actually call. Now you will have the proper approaches and what are the things that you need after analysis. Now you will take this planning and analysis part and go into the actual programming and then code. This is where the actual code starts. So here is where you will identify which programming language you will use for that particular problem. So if it is game development, you might need to use C plus or CSRP. If it is for any kinds of web automation or something like that button would be sufficient. I think you have to really identify what kind of programming languages you're using an actually quote, right? So the actual main implementation part comes in the design. And the step four is implementation. Now, once you have analyzed and plant, and now once you have designed, will get this as the programming language that you use. And you have already started writing some code. Now here is where you will try and test. So you'll try to run the cases and then see the bugs. I see the errors you could try to fix it. And all those things. This is where you will have to analyze the actual use case and actual test cases that can come later as well. But here is where all the nitty-gritty stuff happens. So step three, design and step for implementation is where actually you will code, right? So that is step four. Step five would be maintenance. Now, once you have, now after maintenance, after implementation, you will have a program that is usable, that is something that can be published. Now, once it is published, now we have to maintain it. Because in programming what we say is there are updates that are going on in every programming language. The new update can come. So you have to really stay alert and stay updated with those things. And that's why you have to maintain it not only from that, but from the bandwidth and from the server side, it is always better to always keep IN chicken balance in the system. So that's why maintenance is quite important and this is why you will trust try to run the thing once in a year or twice a year just to see if everything is working fine. If not, then you will try to fix those errors that are coming up. So that is step five. Now, according to the waterfall model, that's it. We completed the fifth number, but now I will give you one more bonus, step six, which is a bonus step. And that is pushed analysis. Now once you have done everything, everything is running. It's up in the cloud, up in the server or wherever you are using it. And it's totally running good. Now you have to analyze what were the mistakes and what are the bugs that are coming up. So this is where you will have pushed analysts reports, right? So if the program crashed or not, so you would take crash reports from the users. Maybe you will do Q&A, Q&A testing and stuff like that. So this is why you will analyze whether the program that you created is working properly or not. So those were the six steps of software development lifecycle, and this is how software is developed. Now in the second next episode, we'll be talking about how we installed Python. So we'll be talking about Python installation in the system, and then we'll go more into Python. So now, once we have, now I think we have covered all the programming basics. Now we are actually diving into Biden. Next episode, we'll be talking about how to install Python in your computer. 5. Python Installation in the System: Install Python. So first thing you have to do is either if you have Mac, then you will firstly wanted to check if your Mac already has Python. You'll want to open terminal. So in my case I have Mac. So you'd want to search for terminal and type a command called Python itself. Firstly, you will try to put Python. And if it does not give, then that means you do not have any Python. Now, that's not it. So there is another command which is Python three. So if Python three works, which in my case it does. So this means I have Python, so no need to install, it's there, you can just use it. Now. The thing you have to pay attention is the version number here. So if it is Python 3.10, which is the latest version, which is great. Now, usually what happens to most of the people who have not installed Python if this C Python, which also applies for Windows as well, it solves Biden similarly, but then it has Python 2.7. So in such cases you would need an aversion upgrade, which we can do just like this. Now, if you in Windows, then firstly, you can try checking with Python and Python three itself. If that does not work or if it shows lower version like Python 2.73 or something like that, then you would need an upgrade. So in that case, then you would go with this approach. Now in that case, what you'll do is you'll just go to python.org slash downloads. Now once you are here, you will see the Python download website. And you can see this yellow button here which says download Python 3 something. So this will be the latest version and it will automatically finalized and select the operating system you're in. I'm in macOS, so it says macOS, then you can simply click on this yellow button. You did not need to be worried about the OAS and things like that because biting website automatically detects it. Now once it is downloaded, then you can just open it. In Mac, it says dot PKC format. Then you can basically continue and just run it like this. Continue, continue. And then you can just agree. And then once it is there, then you would just click Install and that's it. So once this is done, in my case, I do not need to install it. But in your case, you probably need to install it. If you don't have it, then you would just simply click on Install. And this is how you install Python in your computer. And just to check it out, once you just go back to terminal once, just to make sure that it really works. You can just close the terminal once and then reopen it again and then check for Python. Either Python or sometimes Python three this, but it really depends upon the path and both variable that you are putting in. So really it can be different in computer to computer. So most probably it should be in either Python or Python three. If not, then you would have to re-install it again. So that is how you install Python. The process is pretty similar in Windows as well. In the windows, you have to make sure that while installing Python, there will be a checkmarks that will come. There will be one check-mark called add to path or add to environment variable or something like that. So make sure that it is click or checked. Usually it is not. So you have to make sure that you check it out. And once that is done, then only you will be able to get this. Otherwise that would be a little bit of trouble. So this is how you install Python in your system. And once you have the system of Python in your computer, then the next process, what we'll be learning as we'll be installing PyCharm, which is the IDE that we'll be using in our computer to code python. And in the next episode we'll be covering the installation of PyCharm, which is an IDE. So we'll be talking about that in the next episode, I think. And I hope you will have installed Python till then. If there is any questions or comments, then make sure you will ask and discuss in the discussions. Otherwise, we'll move on to next one. 6. PyCharm Installation in the System: And installed Python. So let's also installed PyCharm. So as you already know, PyCharm is an IDE that we'll be using. Ide basically means integrated development environment. Ide helps you to run Python on your computer. So basically having just Python, okay, I have biotin, so way to write the code. Like if I have to actually execute the code way to do that. And that's where by chunk comes PyCharm is a Python IDE which we can use. And here there will be writing the code and running the code as well. So for that, let me just close these windows that we just opened lately. And then like we went into the Python website, we'll just say search Python PyCharm in Google. And we can just go to the JetBrains official website. Here. This is the pipe charms official website. And you can see the cookies here. So over here, you can just look around how the development can be done. So for example, you can section screenshots here, see how they are writing the codes, right? So this is how it looks like. And that's basically, there's not much to look at. Now. If you want to download this, then you could just click on that big button called Download, then you will be redirected to this page. Now here's where many people get confused, which to get it. Now, here's the thing. The professional and community, like the professional is more about. It does not have any much of the changes. If you want to see the pricing a little bit, you can just go to pricing and check what actually you get with this thing. But usually we take the community version because that's basically it. It's open source, it's usable, It's absolutely fine. And for Python itself right now, where to use professional is, for example, if you are using Python with some web developments like it says, are psi pi or scientific Python three, in such cases, for support for debugging in cases, you will need to use PyCharm professional, but usually we can just basically go with the community version. So in that case, you just need to select what you want. So in this case is Intel, so I'll just select that. You don't have to pay it. Walk around here, anything you can just click on Download because if you have Windows that you're using, then it will automatically go into Linux if you have it. In my case it was Mac. So I'll just click on download of community. And once it does, it asks me it for it to allow, it will allow it. So let us make it download. And this isn't DMZ format. Doesn't matter. Actually, package is more about how it installed into the kernel. Dmz is just a software, additional software that we're using. So let us download this then we'll move on to installation. Another thing that you can pay attention while this has been downloaded is so for example, you can have multiple different IDs as well. So there are other ideas, for example, Visual Studio code right there, our code editors as well. So you'd want to use those as well. If you are not familiar with PyCharm at all. What I would suggest is if you are very new to Python and very new, then you would also consider to use Sublime Text three. So Sublime Text is also a code editor. This is not as easy as pie chart, but it is not as complicated as participation. This might sound a little bit cliche, but anyways, we'll be using PyCharm in our episodes. So I think you will get a good hands-on on by John, just that if you want to explore a little bit out of the horizon, then you'll want to check Sublime Text three as well. Okay, so now we have our PyCharm installed. Download it here. So let us open that. Now it says this, drag it to this applications. So I'll just drag it to here. Alright, so we have it in applications, we have those things. Now we can just open PyCharm itself. So it'll just verify that a little bit. This is just the case in Mac. So in Windows the installation process is different. It will be dot EXE file, then you can just open and install it. In my case, I'm in max, so that's why DMZ. Alright, so I just click on Open. Then, once we're done here, by doing open, I can just close this window. Now here I will get some user agreements, so I'll just conform and continue. In this case, if you want to share the data, then you can send it or I just don't want to sign it. So it will just say Don't send. Now it's opening. Our PyCharm is opening finally, where our imagination will come into the reality. So let us wait till pycharm gets set up in the system. Now this is where actually, it actually comes into the system. And alright, so we have this. Now. If you want to take some tour, then you can just stick some tour and it'll tell you what are the things that you can do with PyCharm. For example, this. Now it'll create automatically a learning project for you so that you can learn how to use PyCharm itself. Let us wait till it goes with this. Alright? So it says scanning files to index. So what this is doing is basically creating a basic project. For example, we have this PyCharm learning project and this is where all the learning files will be there. I hope these are all Python. So you'll get all the information here. So I can just exit learning. You can just, if you want, then you can just go through it. But since I don't need it, so I'll just click on Exit Learning. I just don't wanna get feedbacks. So that's it for me. Now. Alright, so that is for you. Now I can customize the windows as well. So for some developers don't like the color theme of PyCharm to be black, so which I do, but some people don't. So you can, in that case, you can just change it to light as well, which also looks fine. Macos light also, which is, which is changes that. So you can just see which actually fits your case. For me, Dracula is fine. And you can change the font if you have some text issues are fun tissues, like you feel that font is too small, then you can change the font a little bit. So if I need a little bit bigger texts than I would need to use this, I prefer normal texts, so 12 would be fine. Now, that is further customize now for plugins, now, there can be multiple plug-ins that you might need, sometimes, which you can install from here. So for example, one thing that can be useful as CSV. So if you want to your PyCharm to be able to read CSV as well, then you will want to install plug-ins of CSV. So in such cases, you really need to figure out what is the need and then you can just type it out and see if that really is there in PyCharm or not. Alright, so that is how we basically installed PyCharm. Now, let us go into a new project so we can just create a new project. Now here is where you have to be paying attention. Now you can just name are good location to this. I'll just say python. When folks say by thin, present python learning one. Alright, so I'll just name that as a folder. Now here in the Python interpreter, now we'll be using something called virtual environment. So virtually in V, This is what is called as a separate environment for you, which consists of the interpreter which we just installed in the previous episode, which is Python 3.1, right? Sorry, ten. So that is the interpreter that we'll be using in our personal virtual environment. So that's it. So you don't need to change anything actually. You can just create an main.py script if you don't want that, you can just skip that as well. So in that case, let us create that and just click on Create. We'll have our main script here. So if you didn't have that main script, then you just don't have this file. This file is nothing. Basically it's just a sample script, so we can just delete that and then hit Save. Now, for example, this is, this is overall installation of PyCharm, right? And in the next episode we'll be talking about, in the next episode we'll be talking about how we can write our first Python program. So we'll be actually coding in our program we just created are fighting file, which is main.py. This is also directly done by the PyCharm. We'll learn how we can do it by our own awesome. Next episode we'll be all about creating a Python file and writing it and running it. So that is the thing that we'll be looking at. So if you have any questions, let me know. Otherwise, we'll be moving to the next lesson. 7. Writing Your First Program: Alright, so now that you have installed Python and PyCharm, now the next thing we are going to do now is to write our first Python program. Now, as you know, we can just open by champ like this. Then what we can do now is we can just create a new project. So what this will do is basically this will create a new project that you can walk on as a Python files as all discrete click on New Project. Now you can give a name to this project, so I'll just give this name as first writing, right? Then other things you need not change for now and later on we can change, but for now, we can just leave it just like that. And then just click on Create. Now it'll create your whole environment and everything. And it will start with this main.py script. And we can just delete all these things in the script that just whatever is written, it's just like it's not necessary. So I'll just say Delete. Now. What we can do is basically I can create multiple different Python files. So if I want to create Python file, let's say I didn't have main.py. Let me delete this. I'm delete. All right. So let's say I didn't have anything. So how to start? Now, we'll just create a new file, new Python file. And then I will just give this a name. So I'll just call this app. By now. Every flight in file has this extension of dot p-y. So whatever the profiling I'd lost, you must put dot p-y. But in this case we'd need not because it's already Python file, so I can just hit enter. It'll just create app.py, right? You can name the file whatever you want. Alright, so now that we have our app.py, now I can write our basic code. Now here I'm won't write anything complicated or something like that. We'll just simply print Hello world. So that is the basic thing that we'll be doing. I'll just say print, hello world. So this is how you print in Python. We will learn this in a later parts also. But this is how you print something. So print, and then with quotation mark, you can specify what you want inside those two quotation mark. I can print whatever I want. And one thing, one good thing about PyCharm is that for example, if you want to know something about, let's say printf function here, I can just go over here, click here and hover. And then I will get this thing, this blurb, which says you can see def print, so there's a function. And down there you can see prints the value to a stream or to start STD out. So if you don't know, Python is basically a meet up on C plus plus. So basically it works with C plus plus in combination. This means it's historic. Std out is a C Plus Plus command to throw out into the terminal whatever you want to print, right? So that is that absolute keywords file. So I can print the file. So it'll basically this, this part, this is the benefit of having PyCharm. This will give you a basic understanding of what the function really is. And that could be helpful for you. Alright? So now that we have this basic Python code, what we can do is if I just click on Run, you can see it says count open file. Now if you had that main.py, it would just run it perfectly. Now here we have to debug a little bit. So it says, can't open the file main.py. So can you see there's no main.py, right? So no such file directory, it's obvious. Now what we have to do is we have to click on this button here and we have to edit the configurations because we have changed the file name. I can just click on edit the configuration. Now I can just change the script bot. So what script that I want to run that I can just click on here and then say app.py rate because that's how you name all the things we don't need to change, then we can just click on Apply and Okay. Now if I click on Run, you can see the name is also changed and this is printed that hello world. Now for example, let's say we created another file, python file, and call it, let's say mean, right? And let's say this printed main file. And if I, for example, I'm working with two files, but I want to run these separately. I don't want to edit the configuration every time. Then what I can do is I can just click, right-click on this and then just say run mean, right, that would just run this file, right? Otherwise, if I click on here, the latest, we run the mean right? Now if I click on app.py and run, and then right-click and then run app, it will change here, right? So that is how you, how you can change or not change the configurations, but still use run like that. So right-click run and that would just run. Otherwise you can just click on Control Shift and then are also that could also work. Now, this is how you write your first Python program. Congratulations for you all that you wrote the Python file. And it's really awesome. Now, the next thing that we'll be looking at is data types in Python. So we'll be looking at what kind of datas are there in Python programming. So that's what we'll be looking at. And after that, we'll be looking more forward into other complicated and too complicated, but just overall, more advanced processes. And I think you did a great job on running your first Python file. You can just walk around, play around a little bit with this biting file, and we'll be looking at other things in the next video. 8. Data Types in Python: We looked at basically how to write our first Python file. We just learned print statement. Now in this episode we'll be looking at the data types in Python. Programming. The whole thing concept of programming is all about manipulating and working with data. And data plays a huge role when it comes to coding and programming. Because you see everything in this world is all of data, all made of data. This means whatever you look into the world, like whatever place you go, there is some kind of data walking around green. And programming is all about manipulating that data. Because if you look at the programming principle, it's IP. Alright? I think we've talked about this. I view basically means input processing output. Right? So this is the basic principle of programming. Now, what this means is input is all about data. Input. Whatever input, everything is data. We input the data to the computer or program. The program will process that data and given output as a data, right? So it's all about data. The input and output, both parts are data. Program is all about manipulating that data. And since data plays a huge role in by a programming, there are types of datas that we categorize. Those types are known as datatypes. Alright, datatypes. Now, this is just a commenting, so we'll be looking at that commenting part, little bit leader. But that's a common thing, things datatype. So what is datatypes? Datatypes are all the types of data that are in the programming language, right? In this case, we're looking at the data type in bytes. Right? Now. Datatypes can differ from programming language. The programming language, for example, if the programming languages C has char, Python does not have char. So it really depends upon the programming language. In fighting, we have five kinds of data types. So I just pointed out, you can just point and noted down somewhere so that you remember. What I would suggest is when you look at this whole course and you move forward with this course, take a pen and paper or copy or diary, whatever you have, and then just make a note of this because this will be really helpful for you. Alright, so the first thing that the first type of data that we have a string, we'll look at each of them in detail later. But I'm just trying to get out the names. Secondly, we have intensive. And in the number three we have float. Number four is our Aries is Boolean. Now, these are the five types of data, string, integer, float, areas, and Boolean. Now, it's good if you remember this. Obviously I don't believe in remembrance and remembering something, but I would definitely suggest you to remember these because it will be really helpful in the coming days. String into a float, arrays and Boolean. Now, the thing is, areas have subtypes. So 4.1, the first subtype of areas is list. There are three sub-types versus list. Second is set. Let's call it four types because there are less set and tuple. And finally it's dictionaries or logistic. Call it dictionary. Alright? Yeah. These are all the data types that are in Python, which we'll be looking at in detail in the next episodes. But let me just go through all of these, just quickly. Write. String is all about. It's, the word itself says string. String means it's a group or combination of different characters, characters, right? So this is how it is also in Python, string means whatever is inside double quotation or single quotation. It can be any of those, right? Whatever is inside here. It can be number, it can be letters, it can be anything like this, anything that is known as stream. So whatever is inside a quotation mark, those are string. Whatever the, it can be single quotation as well. It can be double quotation as well. That is string, it can be numbers, alpha-numeric symbols also. Strings are always determined with this quotation mark. So you can just remember like that. Similarly integers are all numbers. So for example, 1718202212. All these things are entasis, right? These are the whole numbers. And there's not much about integers. It's basically numbers which are very like exact numbers, right? Similarly float are also numbers, but float or a little bit different numbers that are with decimal points, right? For example, 12.013.3314.09, right? It can be anything with points. So if it has points, that means it's a float, right? And similarly, arrays, we'll be looking at areas in a bit detail in the next episode. So I would not like to go into the arrays. But booleans are true and false. True and false. So these are the two values that are brilliant. So we'll be looking at all of these in detail in coming episodes. So these are just to make you understand what these are, will be going through all of these data types in more advanced way. And we'll be looking at what kind of characteristics they have, what kind of changes we can make in these. So all of those and using it in Python specifically, we'll be looking at those things in the next episode. So in the next video we'll be looking at integers and floats. So the second, third, alright, so we'll be uncovering those because both are numbers. So it will be easier for us to understand those. So that's what we'll be doing. I would suggest you to note this dance. And if you can, please, you can remember this because it will be useful. Otherwise, you can just understand this as well. So whatever is good for you, you can just note it down and just revise a little bit so that later on it'll be easier for you. Then I'll see you in the next one. 9. Integers and Float: Last episode we talked about how and what kind of data types there are, right? And we looked into what are these data types that are used, particularly in Python. And some of this, just to mention them, where firstly we talked about antigens, right? Secondly, there were fluids. Then we also talked about, sorry, let me comment this out. Then we also talked about the third thing that is string, great. And then fourth, which is Boolean. And we saw that fifth words, arrays and arrays have some subtypes which are a set list, we can say list. Then we talked about the dictionaries, right? And see, we talked about there were tuple and D. These are the data types that are used overall in Python. Alright, so that's the basic thing. Now, in this particular episode, we'll be looking at the first two datatypes, integers and floats. Now what are integers like if you have a little bit of background with mathematics and numeric things, you know about that. What entices are, right? If you are not from mathematical background or you don't know anything about mathematics or anything at all to find basically what integers mean, our numbers, okay? So numbers, floats are also numbers, but different kinds of numbers. So each of those are different. So we'll look at it with an example. So in deserts are pure numbers, alright? So for example, if I say 12151613, right? 10 minus one, all these are integers. Alright? So if the number is whole, one number, then that's alright. Coming with the fluid, it is a little bit of different value. Floats are with decimal points. For example, to 0.015.113.00116, right? Anything a number with a point is known as flip. Alright? So the integer is the, by default number itself, the whole number. So the main numbers and floats are the numbers with decimal points, right? So if there are any numbers with 01 or like that with points, then that becomes our float. Alright, so that's the basic distinction between those. Just to check it out with Python, I'll just like to call a. I'll just assign a to 15, which is an integer. And I will just assign B to 12 or just 15. Let's see, which is our basically fourth grade. Now, if I say print and print beep, I'll obviously get the value three. I'll get firstly 15, then 15. I'll just run the mean. Then, as you can see here, 1515. Now. But if I want to see the type of this, what I can do is I can say Type and then parenthesis. This will be two parenthesis in that case. So type of B, if I say type a and type B and then run this, we're not printing the value, but we're printing a type. Can you see here the Firstly it says Class int. Int is in salt form for integers. And the second type of B is class of float. Float is known as float in Python is what we call an integer, right? So you can see the distinction between these values. Now, there can be multiple use cases of these values, but for now we're just trying to understand what particular datatype mean. With the example. We saw these examples. I want you to practice this also, and then we will look at it in the next example. And the next episode, we'll be talking about another two values which are string and boolean. 10. Strings and Boolean: Lot looked into integers and floats just before this episode. Now in this episode, as I already told you, will be looking at string and boolean. So let me just remove this and also remove this. Alright? So let's understand what string and boolean by itself mean. These are two different values. It's not like the previous ones, like integers and floats where it were somehow interlink to as the numbers. But strings are different values and types of datatype and William are different datatype. Now let's look at what they are. The first string. So what is string? Literal definition? String means those elements that are combined together. So meaning if you have a string of letters, meaning you have bunch of letters that are combined together into a pile of it. So it's just like that. So if you are saying string of data, it means multiple elements combined together. So how we write string in Python is with either double quotation. That's one way to write string, or single quotation. So whatever comes in-between is known as one string, one whole string, even if there are spaces, numbers, it's often numeric symbols, all of these. So these are known as strings. Also, this can be done same thing with single quotation as well. So both are applicable right? Now, if I want to put this in a variable, I can do that because C variable, it means that what variable means is that we have a particular element or value and that we have basically saving it and giving it a name, right? That's what it means. So that's why I'm just assigning a to this. And if I print a, then I will just basically get the value of a, which is that string, just like that. And if I see that type of a in this case would be string, class of string just like that. So we're just trying to check the type. Alright? So that is what string is. Understand this, that string can be alphanumeric. It can have symbols, it can have numbers, it can have alphabets, anything. Alright? So if you want to have a value which stores, let's say just the symbols we have to use string. There is no other way too, right? So that's how we put string. Alright, let's look at what Boolean means then a Boolean or a different set of values or data. In Boolean, we have just two values. One is true, is false. There is no any other value that comes in. So Boolean means either true or false. So it's like a true false value. This concept of boolean comes from a binary code point of view, which means in binary we have 0101 means in binary language is 0 means off. One means on it just like that, 0 means true and one means false. So that's what Boolean value is. If I say eight equals true as our b equals to, let me just put like that. And then if I let say print the type of B and run this, you can see it says class bool. Bool is the short form for Boolean, right? So the type of the data B, which is stored here is a bool, right? It's a Boolean. Alright? So that is what Boolean is. Now where we use all these. We will be looking at another lesson incoming episodes. But what we're trying to do right now is established. We are trying to establish a foundation of understanding what particular things mean in Python. Because if you directly jump into things and directly tried to understand how to use the Boolean values, then you'll miss out on other things. This is what we're doing is we're trying to lay the foundation of the programming concepts and terminologies so that it will be better for you in the coming days to understand the real world use case. So that's what our motivation is. Now, as we already said, false, it will also like that. So if I print the value of type of fault, that B, which is still false, will be also a bool. But this won't be true. I mean, this won't be applicable if it is not with the front cap rate. So if it's not with capitalisation, then it won't work, right? That would give us a syntax error. Then it would say, okay, that's not defined. Did you mean false, right? Yes, I meant false. Also with a true it won't work like this also, you have to use the capital letter in the first place, right? Just like that. So yeah, that is what strings and Booleans are. If you have any confusions, feel free to either e-mail me. You can contact me by e-mail. My e-mail is COVID at COVID punted.com. So you can at anytime if you have any confusion or something, if there is any discussion board here, you can just predict in the discussion board. Otherwise, you can just email me also, if I have, I see your e-mail and I will be happy to reply to that. Anyways, in the next episode, we'll be looking at the, the arrays and we'll be uncovering the secrets of arrays and what they are and how you can use it, right? So I'll see you in the next one then. 11. List Data Type: Into integers, float, string, and boolean. We covered all these four values and we understood what they really mean and what particular looks like, right? In deserts are numbers float or numbers with decimal points, strings with double quotation or single quotation, Boolean, either true or false, right? Now what are arrays? Arrays by itself have more points in itself, but what is the main concept of arete? Every is by definition. Now, the definition of areas can differ from person to person and from programming language, the programming language somewhere in the Internet. You might see also that in C plus plus are somewhere. They can use in the name of list. Where what they really mean is lists, they can call it as a race. We can call that out as well. But arrays, by definition, it means that it's a bundle of different multiple elements. It can be multiple values, it can be multiple, different datatypes. It can be anything, Right? It's a combination of multiple elements, whether it's strings where inside one value, right? It is a combination of those values. So that is what it is. Now list, Let's arrays in Python, this is Justin. Python. Areas have four different types. One is list, second is dictionary, 30s tuple, and fourth one is set. Each of these have their own functionality and each of these have their own use cases. And also they can be manipulated in a different ways, right? So let's look at what they really are and how they look like. Alright, so erase. We already looked into, let's look at the list. So what is list? List is, if you see a square brackets like this, this, you have to understand that the list, alright? And it can have multiple elements separated with a comma. So I can have the same elements also, same datatype, 12345. Now this type of list, we'll call it as a list. And let's say I have afford list. So I can put 1.02.13.2 or 4.455.0013, something like this. We can call this afloat. Okay? And we can also have a string list. I can see by thin when fox programming this, we can call it as string list. Okay? I can also have Boolean values. So I can say true, true, false, true, false, like this. We can call this a Boolean list. Right? So what basically it means is we are using the same numeric datatype. Int is a datatype, so similar datatype, that's why we call that, that datatypes lives right? Now. We can also use multiple datatypes. So I can say Python comma one, comma two, comma 2, 76, something like this. We will call it as mixed list because this has all of the all of the data combined, datatypes combined. All of these are correct. So all of these kind of things are known as lists. We consider all these as list. If I say a equals this, equals this, C equals this. And if I see that type of all these, Buffy, and then I will just copy this. So a, B, and C Then comes the income z. And if I see this, run it, I can see all of these are list, so they're not considered the indigent list in Python. It's called list. That's it. We're just trying to understand it with these terminologies. Okay? So that is what it is now. That is list. The use of list is there can be multiple use cases. So we'll be looking at those in our upcoming episodes where we talk about list methods. We can use list methods and we can use many things. We can use indexing slicing. So there are many things that we could use with this. So we'll be looking at those in the next episode. So the next episode could be then our, we will. Okay, so now that we know about list, now we can understand the thing about. 12. Dictionary, Tuple, and Set: Now here in this episode, what we'll be looking at is the remaining three types of datatypes which our dictionary, tuple and set. Now we won't be going too much with tuple and set because that, because there is not too much actually with tuple and set. But we'll be looking more specifically on dictionary and what it is and how it it looks like. We will still be looking at tuple and set, but not that much because tuple and said, I have their own distinct features and they're not used that much. And we'll be looking at their use cases in the coming episodes. Okay. So I'll just put it in here. I'll just make it as dictionary. So firstly, let's talk about dictionary. So what are dictionaries? I think before we talk about dictionary, let's talk about tuples and set. Tuple. What is tuple? If you see any parentheses, then you can say it's a tuple in a value. So as you see, this is an array, so it can be combination of elements. Now this can be as the list. It can be combination of semi elements, different datatypes. It can be anything, right? So if I say equals like this and print the type off, then I can see that it's a tuple, right? It's a tuple. Now let's say, okay, that is fine. Okay, with the three list, it's fine. What about with one element? Now, here comes the tricky part. Now it will say int, though there's datatype parentheses. Why? This is because Python will understand that, okay, there's just one element, meaning there is no comma. So meaning it's not a tuple, but it's just a parenthesis that we put. Like, for example, when you say print like that, great. So that's why to make it understand, we have to say if there is just one element in tuple, we have to put comma. Now we didn't say, Okay, that's a tuple. You can have multiple elements also. Apple, right? So like that. So that is about tuple. Tuple that has its own use cases which we'll be looking at in our next episodes in future. But that's for the tuple. Let's talk about set. So what is set? Set is curly braces, but not just curly braces, and it has just elements like one comma two comma three. Then you can know that is a set. Okay? Now with this set, you can see the type of b. Then if I run this, you can see it's a set right? Now. Why is this set? Because it has curly braces. That's one way to identify it. But dictionaries also have curly braces. So how to identify is directly with common dictionary have different thing called key value pair, but this does not have it. So that's why we can know that as like that. Right? So if you want to understand, okay. If that's set or not, then you have to understand, okay, if that has curly braces and comma or not, then it is saved. Now, those things are aside. Set also has its own particular use cases, which we'll be looking at in the coming episodes. But now, let's focus specifically on dictionaries. Now what is Dictionaries? What our dictionary is actually? Let's look at it. Now. Dictionaries are also with curly braces. Curly braces, yes, but it has something called a key value pair. Key value pair. Now what is key value pair? So for example, in dictionary, so let's say you open a box and Oxford Dictionary, the English dictionary. And you can see there is worded meaning. It has one word and it has its own meaning. It's something like that. So you have one particular value and you assign, sorry, you have one particular key, and you assign the value for that key. It's like saying formulary. So x is, let's assume that x is like that. So similarly, we can say that Apple has a key, that is key, and then we separate the key value with Colin. So this is like a colon, not semicolon, but Colin. Apple colon, the meaning of it. So fruit, right? So that would be our value. This string is our value, and this is string is our key. And then we separate with key-value pair with commas. We can say banana is yellow fruit. And similarly we can also put comma. We can say grapes and red fruit or lytic green fruit. Okay? So now if I say print the c, Then you can see it will just print our dictionary. Now if I say print the type of thing, you can say, it says dict, which is the salt form for dictionary in Python. Alright, so our c is the dot. Now in this case, we can also have not just string, but we can have the value one of red fruit too. We can have different data type that we just learned as key or value so that we can replace, so that we can use according to the use case. But here what we are trying to understand is the concept of key value pair. So one is key, a red fruit is valued, whiskey, and yellow fruit is valued, three is key and a green fruit is value. So that is how we do it. Now, how to use it, how to identify, how to get the values, how to manipulate those. Those are the different chapters and those will be coming up in the next videos. But here what we learned was about tuple, how they look like, and how in Python, how we can write it, set how they look like and how I can write it and dictionaries, the concept of key-value pair and how we'd write it, right? I want you to practice this once all these values in deserts float string, boolean, arrays. Arrays also list dictionary tuples sets and try to play around a little bit with different values, putting different values, printing those values, printing the types of those values. C, programming is all about practice. So the more you practice, the more you'll learn. In the next episode, we'll be looking at the string methods, which is, we come back to strings again and see how we manipulate those strings in Python. So those will be our next chapters. I'll see you in the next one then. 13. String Methods: So string methods. In this episode we'll be looking at the string methods. Now, let's understand what methods are before jumping into string methods, because the next chapter will be about list methods. Now, methods comes from a native programming concept called object oriented programming. What this concept is, is basically it's a concept of classes, which we'll be talking about in coming episodes also. But before we jump into those here, we're just trying to understand the methods and trying to basically understand methods. We just have to understand that methods are those which are done on something. So these are the activities or functions that are done on something. For example, if I have a string x equals hello word, and if I have to do something on x, that means I use, I will use something called dot notation. So x dot, x dot method name, great, mentored, and then we execute that. So the cool thing about methods are that methods send out a different element. So for example, in the case of methods, so x dot method will be a new element, so it will be different from x. Okay? So that's the method. Now here what we have to remember is the dot notation is very important and the variable or the value that goes before that is also important. So for example, if I have x equals hello world and x dot, we will execute the method, right? So that's the whole idea of methods. Now. Methods can be, of string methods. Methods can be off list methods as well. So there can be multiple methods. There are dictionary methods, right? So basically what those are, what we are trying to do with the methods. He's basically trying to execute some action on that particular value. So in this case, we'll be looking at string methods. Now, there are a lot of string methods. They can be depending upon the use cases, that can be a lot of them. In this case, we have just taken 24th them, which are widely used and can be helpful for you to understand. So we'll be going through each of these in detail and trying to understand how they work and what do they do, right? So I think you have opened PyCharm and we are ready to go. So firstly, let's talk about capitalize. Capitalize. Okay? Here, again, just to summarize the methods thing, what we have to understand is it is just some notes. Here. Methods are done on the value and use methods. We have to use dot notation. That means star dot, right? So that's the whole idea. These are the two important things. Now capitalize, capitalize. As we can see here, what it does is it converts the first character to uppercase. For example, Let's say I have a string called S. String equals Hello World. Right? Now, you can see capitalize is the string method. And as we said, method is done on the value. In our case, string is our value, right? So for example, string dot capitalize should do it and we are using dot notation also. Now if I just run this, nothing will happen because I have not printed it. So I have to print this to see in our console. I'll just print string dot capitalize. And I can see that hello world with small will be changed into Helloworld with Edge Capital. Because you remember the function of capitalize is to convert the first character, which is the edge to uppercase. Alright, so that's the use case of capitalize. This can be useful whenever you are taking in input, for example, of the user's name and you want to capitalize it. In those cases, it can be helpful. And so that's the thing about capitalist. Basically, you have your value, you store it and uses, say, okay, now don't capitalize, then print that whole thing, right? That's for the capitalize. I think it's clear for you. So let's move on to our next one. That is Keith Ford. The use of case folded, it converts string into lowercase. So for example, under C. So for example, I have, let's say string, string called edge, like this. And if I say print, the string of keys, fold. If I print it, the first one we can just ignore. And here you can see all of the letters are now small, right? It has been folded. The case has been all the capitals have been folded, right? So as you can see, it will convert the string into lowercase, right? So that's the use case office. So if you want to, for example, check all the things in the lowercase, right? Even if it has like up and down, up and down. And you want to get all of them to normal, then you would use case for it. So that's the second. Now, let's go to the third one. In the third one we have centered. Now center, we don't use that much. So it is used to return the center string. So how we can use this as basically, let me write it down. So for example, I have, let's say a string of, um, okay, let's just do it on SGR, STR and G. Fighting programming, right? And if I print the string and Art Center, then I will have to pass in our index, for example, which one do I need? Let's say five. If I print this. Now in this case, five is the 0123453 and that is the center. If I say seven, that does not change. So basically what we're trying to do here is a returns a centered string because it is in the center. So understanding this, that the value that are here are all in the central form. You can see it's in the center. Now. For the fourth one, we have count. And in the count, what it does is it returns the number of the times it is there. So for example, let's see from the example. So this is for the count. And let's just specify our string as, let's say string three equals Hello, World again. Okay? And then what I want to do is I want to string three dot count. I want to count the letter L rate. In that case, I can use not count, sorry. Print. And I want to see this. That's why we'll print it. So you can see it has been repeated three times 12 and then three, right? So if I increase the count, for example, if I increase l in that string, It will see for, right? So basically, if you want to, for example, when you write your real-world code and you want to count some element in your string, then you will probably use dot count metric. Alright? Okay, That's the thing for count in code. Now, there is the thing about encode and decode. Basically what that means is you are, you have a string, you want to encode it so that not everybody will understand, right? We use that. They can be a lot of types of encoding which we can specify also will use normally encoding here. So the string foo equals, again, I'll just say fighting. And then I'll just say string four dots in code. Now, if I want to specify some kind of encoding, then I can just say encoding equals and then give the name of the encoding. But we'll just use normal encoding method here. Since I wanted to see this. So I'll just print this also and run this. Okay, so here we are using normal, the encoding method called UTF eight. So what this does is basically it also encodes, for example, some special characters. For example, something like that's the default one. You can change that as per the need. But for example, if you have in your string some kind of, let's say MOZ, let's say this one. Alright. Okay, that went there. When I encoded it. Can you see here it has been in the encoding form. The cord. The cord. It's called Unicode. It's the core of that particular MOZ, right? That's, that's the thing. So in that case, this encoding will be helpful. But if you don't use any code, then it will just basically print out that same emoji, just like that, right? But in some cases we might need the encoding. That's why we can use encoding by default that encoding is like this. If you don't put anything, Also, it's the same thing, right? So yeah, that's for the encode. And we have ends with. So let's go to the sixth one. Ends with so what is Ainsworth? Basically it is, Let's understand, it returns true. That should be actually a Boolean if the string ends with that particular value. So for example, string equals string five equals Hello World at gmail.com, right? And print string five. Dot ends with.com. This should be a string. So if that particular string ends with.com, then this will return me, which is true, right? But for example, if it does not end with.com, then it will return me false. Okay? So that's for whenever you want to check for something which ends with with something or not, then that's when you will use ends with. Similarly seventh one is find it. So just for that string, for the string specified value. And it will regenerate that. So let's see, understand this by an example. So this is fine. So I would say string equals or strings six equals. Let's see. I don't know. I love programming. And if I print the string six dot find, I want to find, let's say, okay, then I just run this, then it returns me an index. So for example, I is 0 species one. Let's do right. And if I see LO, then that would still give me two because the initial one is two. That's fine. The only the initial one will be taken as that. So if I see m, the initial one will be taken. So run it. 13012345678910111230. So the initial one will do. So that's how we find it. And basically it will give us an index value. So that's the use case of this. And similarly. So for example, that's for defined. Now for the format, the format is a little bit tricky. You can make a note of this if you want, because later on you, it can be really helpful. Format can be a little bit tricky because format is used for usually formatting things. So for example, if I have, let's say string seven equals, I want to replace the value. Here. For example, I put these curly braces and string dot format. Then I can switch that curly braces with the value that I pass in here. So here, if I print that string, if I print this here, you can see wherever I put that curly braces the opening and closing, it replaced over there, right? So the value that I give here will be replaced to wherever curly braces you have. If you have multiple curly braces. So for example, here one value, then the initial will be taken here. So here will be gone here, and the next value will be sent to other, for example, here too. Then you can see that here is replaced over here. This first one is here, and then second one is here. Just like that. So it searches for the curly braces and replaces that with the value that we provide if we don't provide the value. So for example, if we have two curly braces and we just pass in one, give us an error that you wanted me to replace two values, but you have just given me one value, right? Those things. And similarly, we have many more here. But I would not like to go all in detail because maybe where we will be running out of time also. What we will do is we'll take some important ones. So we'll take index now, because index is also important. So let's go into the index. Index. So what is index? Index is, as you know, index values, right? So all the elements or characters have their own particular index value starting from 0. Every character in a string is 0123 and it keeps incrementing. And similarly we have index method to find out which index a particular value is in. For example, the string eight equals. Hello, right? If I say string eight dot index of I want to see the index of o, then I will just print that. I have to specify this two values. Okay? Then if I run this, you can see it's in the fourth. So this means fourth index. So 01234, right? There, always enforce one. So that's what index does. It basically gives you the index value of that particular, that particular character in that string. So that's for the index. And all these is, is, thinks, what do they do? Is they basically check whether or not that particular string has that or not. For example, if we use dot is all num. This we'll see if that string is alphanumerical. Naught means it has both alphabets and new numbers. If I say is Alpha, then it'll true, return true or print true. If all the strings are alphabet is A-S-C-I-I. What is the full form of AAC? It's American Standard Code for International interchange, sorry, Information Interchange. So basically what that means is it is a list of codes that are associated to characters and numbers and alphabets and like that, right? So this is like an universal library of cool. And it'll check if that character faults in that university library or not. Is decimal means. If the strings are decimal numbers or not. And it does, it will try to find if will return true. If that string has deserts is lower means it is lowercase or not. It'll check for that is numeric. We'll check for whether or not it is a number or not. It's basically check for whitespaces. So for example, if it's all whitespaces, then we might need to remove that. In those cases, we might need that is title. So title in Python is considered when all the letters, all the words of a string, I considered uppercase capitalist rate. So for example, I'll just give an example. So for example, hello world, COVID. This is a title, but if I see something like this, then this is not a title. So all the words would be capitalised, the only the first letters and all the things. So in that case that would be a title is upper. We'll try to find if all things are in uppercase or not, right? Okay, so we'll go into join because that's important. We recently talked about. Let's go to Zola. Recently talked about list, right? So join will use lists in this case. For example, if I have e, which is a list of E, B, and C, then what I can do is I can print in empty string joined together with all the elements of a. So what this will do is basically it will attach all the elements of a to an empty string. So if I run this, then you can see a, B, C, all these different characters are joined together. I want a comma and space, then I already use distinct comma space. Then it will add all of these, a comma b comma c. If I want a full stop after each element that we are iterating through or adding through, then I would use it this a dot b dot c. So that's how we use dot join. The dot dot join will be used quite often when you go into real-world projects. Also, later on, it will be very useful. And all the things I think That's join is important. Lower what it does, it converts all the things into lowercase and starts with adjusts the opposite of ends with. So it'll check for the startswith with a string, starts with a specified value and not. The title will again change all the words into uppercase. The only the first characters capitalize, translate, will just translate the strings into one form to another. And upper will change all the strings into uppercase. So these are how we use string methods. Obviously, we didn't go with all the 24, but we just covered the ten most important ones. You're going to want to try to practice this. Because I always say this that you have to practice a lot in programming. It's all about practice. So keep practicing and I'll see you in the next one. Next one would be about list methods. So similar to this, here we looked into all the string methods. We tried to manipulate the string. Now in the next episode we will be manipulating the lists. I'll see you in the next one. Keep practicing happy coding. 14. List Methods: Alright, in the last episode, we looked at the string methods. We looked at all the possible methods that can go with the string and how it can help us to manipulate the string. Now in this episode, we'll be looking at the list methods. The concept of methods are same. Because last time I think if you remember, we took some notes and said that methods are done on the value, right? That's one thing. And to use methods, we have to use dot notation. Those principles are seeing just that the value that we'll be using previously was shrink. Now it will be listed, alright? By list. If you don't remember, list are those values which are inside a square bracket and separated with a comma b comma c. Such things are known as list. Alright, so that's the whole idea. Now will be looking at Aldi list methods. We have 123456789101111 of those string methods, I'm sorry, list methods. We'll be looking at the important ones and we'll be uncovering all those things which are important and which can be helpful. Okay, Now, I think let's just jump into it. And we have, here, we have the methods. Let's see. Firstly, we have append. The number one is what is append by definition up in means to add something, right? In this case also, it's a method to add an element or a character or whatever into a list. So for example, I have a list called this one. Let's see. This is a list of comma b, comma c, okay? And if I say list one and not a plan, I can provide one value. Let's say D, that will add D into the list one. So if I print the list one after this and before appending, I can see the difference. So before appending my list one will be just not after appending. Let's see. So before appending it, but just ABC, that's what we give. And once, let's print it. And once we appended that, when we printed the seamless, it has been appended here we can see the difference. So that's what a pen does. And I can do as many appends as I want. So for example, append, append. If I do the same thing, then again, same thing will be added rate. So there will be triple trees like that. But if I want the other elements, then I can just add it like that. Also. I can append whatever I want in the list. So that's for the addition. Alright, clear. What clear does is it removes everything. So let's just see that. That's clear. Let's say I have a list called list2 equals by thin. Fun. And let's say I say list two dot three. Okay? If I say print list too, you can see it's an empty list. Though it was firstly created because I said dot clear, it all, removed everything from that list, right? So that's why it printed nothing. But if I didn't have this, I, if I commented this and it didn't execute, and obviously it will be there. But since we executed that, that means it removed everything, right? So in this case, like in such cases where you need to remove something from your list, then you would use. Alright, let's move on to the next one, which is the copy. Now, copy is also a little bit useful and it's a bit tricky to understand that just to understand it with proper examples. So copy. So for example, let's say I have a list called E equals E. Let's say I have a list called another list, which is the same as a, b equals a, right? It's the same thing. So if I print b, that will be AB. If I print b, that will also be EV, right? Just like that. Now, let's say I want to, okay. Let's say I want to change something on B. Okay? So let's say I want to add something on V. So for example, V dot of ten maybe see I want to ask, great, but I don't want to add to a. Let's say in this case, both a and B will be changed. Because what this is doing, it is basically appending c into b, but b is eventually, so that's why it will append directly to a, right? That's why E also changed. We also changed, for example, because this is. Linked with each other. If I want to create a different copy of this, this is where I would use.com. I would separate a and B. So a is no longer, sorry, B is no longer associated with a. So that's why What happens to be only happens to be no changes will be sown in the E. E will be still AB. In such cases we will use dot copy. If this is not still a viable definition for you, please go back and check this part again because this is a little bit tricky that whenever we would need to create a separate element but similar values, then that's when we will use dot copy. Dot copy will create a separate copy of it, not linked with it. So that's the whole idea of dot copy. I think that was clear. Alright, then we can go to another one which is called count. Basically is the similar as the string methods. If you remember, in the string methods also we counted the values like how many are there? So it's a similar thing. Let's just still practice it. So in this case would be okay. So let's say I have a list called list three equals B y t, t edge. Okay? So I have a double t in bison, and that's list. So if I say list three dot count, and I want to count, let's say t. Then obviously I will have to print this because that's the value that I want to see and it shows me too, because they are t2, t3. If I see why they are just one way, that's why it will be one. And if I see something which is not there, then it will just say 0 because it's not there. So it's the same thing. It's a very foundational principle. It will just count that value in that list and then says how many of them are there? Okay, let's go to another one. Extend. It adds element or to the current list. So what this does is, for example, sorry. Okay. So let's go to an extent. What extent basically does, is basically it is trying to add, for example, let's say I have list one equals e, b, c. And if I use the conventional method of appending, appending. And if I have another list, one, list two equals d, e, and f. And if I say, okay, I want to list one dot append. If I want to add to lists. And if I list two, then you can see it is not a perfect way to do it. Because what it will do is it'll create a nested, this is called a nested list because it's listed inside lists. That's not exactly what we want. We want to basically add, attach these two. In this case, we could use extent. And it will just extend that way. It'll just add two lists together. In such cases, we will use extend in the list so that it's not much, it's just addition but not element, but the whole list to list or triplets lists together if we want to add more or less. So for example, if I have listed three and that list has, let's say just G. And I can just say list one dot extend even more. Right? Then it will be just that also extended. So, yeah, that's how we use extent. Okay. Now let's go to the next one. Index also is the same thing as our, as we did with the string methods. That's why it is important that you watch this string methods also index, also the similar thing. It just is like, for example, I'll just copy the same list. I'll just change the name of it. Say list six. Okay? If I print the list six dot index, I wanted to see the index of B, then it will give me 01 because it's in the 0 to 1 first in X-ray. So that's how it does. Basically it returns the next value of that particular element. Insert, insert will add an element to a index value. So for example, I will just use insert like this. Seventh one, insert. So let's say I have a list called list seven and catalyst one to let's say 678. Okay? Something different. 678. Now, if I want to insert something in the after eight, we can use append also. But how about if I want to add something in-between 78? In this case we'll be using dot insert lists seven. I want to add into, insert into lists seven, insert. So what do we want to insert? I want to insert our index. So where do I want to insert 78, so 012 in the tooth. I want to insert. What is I wanted to insert? Let's say nine. And if I print the list seven. And you can see in, in-between that in the 012 second index, I have added night right here and that it is sifted. Now I can do it also in the first index also. So seven will be shifted them like that. So that is how we insert some value in between something, right? That's how we do it. And that's for the insert. Okay, now let's go to the pop. Pop is something. Let's see this. So when do we use paul is whenever we want to remove a particular index value, a value in the next value. So for example, if I have listed equals 91011, and if I want to let say, remove any element that is in the first element, then I can let say I don't know the value, right? I don't know. Okay, there's ten or 11. Then I can say list one, list eight dot pop. What? This will remove the value in the index number. What? If I print a list state? You can see ten is gone. Alright, that is for the pop. Similar to pop, we have removed what removed dots. Let's see. Remove is also similar, but in this case, we don't pop or remove it with the index value but with actual value. So in the same example, if I would use a move, then I will have to use something like, let's say list nine. Then I would have to say list nine dot remove ten because that's the value. For value. Prop is for index. And Quint. This nine will also do the same thing, 911, right? That's, that's a trait, a terrible date. Alright, anyways, so that's how we remove either from a value or a position. And reverse, there is reversed also, it will basically reverse the whole list. So let's see that also. Reverse. So I have, let's say a equals five is five. Then I can basically say print EB dot reverse. Sorry. I have to firstly EB dot reverse, then I print a b. Then you can see it is fun, is vital rate. Basically it is reversed from back to the first one is biting. So this is used in order to reverse a particular list. This only works with list. Okay? And then finally we have the sort reverse goes from backward to forward. Salt. What does it do is it basically sorts the list based on the value that is provided. So for example, let me write it down 11. What it does is let's say I have ABC equals 1534623. It's in very unordered list. But if I say abc dot Salt and print abc, you can see it's sorted out 123456. Even though my ABC was not sorted, because I dot sorted. So it'll basically sorted like that. And also if there are some alphabets, then it'll also sorted. So for example, certain numbers. But if it is, let's say a, B, C, and D, You can see it will be EBC. It'll be sorted out like that also. It works both in numbers and, as well as alphabets also. So that is how you sorted. So again, I think that's it for 11 list methods. It, we're not too much also. Again, list methods are only applicable for lists. As you can see, string methods are needed for strings. This methods are needed for list, so you can't combine them together. Obviously, there are some methods which are maybe similar. For example, index count rate, but you can't use, let's say copy or clear or append in string. And you can't use other string methods into list, right? So you have to find that distinction and use it accordingly to your need. Again, I would want you to practice this on your own. You can pause this video, go back once, watch this on your piece and try to understand what these methods are doing. Because later on when you actually cooled on biting, it will be really helpful for you. So our next topic will be on crude. And we'll be talking about create, read, update, delete the crude method. And after that, we'll be looking at other things also. So I'll see you in the next one. Happy coding. 15. CRUD: We talked about the list methods. Now in this episode we'll be looking at crude. So what is crude mean? Let's look at what it means and what, and how it is useful. So crude means basically it's an acronym for create, read, update and delete. Okay? So what is create read, update and delete. Now this is a concept that might be helpful in the next chapter, because next lesson is going to be on dictionary methods. So when we look at the dictionary methods, this will be very helpful because the concept of crude comes from database. So DBMS, we call it DBMS is database management system. These, these acronyms and these things are quite helpful for you. So make sure you note it down somewhere. So database management system, it's called. So the concept of group comes from a database management system or DBMS. Because in database, we can have to be able to do these operations at least. So we must be at least able to create database. We must be able to at least create, read the database. We must be at least able to update the database, and we must be at least able to delete something in the database. So these are the preliminary things that a database needs. Now, in the case of Python, we will be using in the next chapter, we'll be learning about dictionaries and we'll be looking at those. But just to understand what create does, what Reid does and what update does, and what delete does. Let's understand this. So let's say I have a table in a database, so it's called S N. I have named, I have, let's say country. And I have income. And I have, let's see it. And I will say one. Okay. Then I'll say Henry, he's from UC. His income is a 100 thousand. Okay. And then this is, let's say 50, right? Similarly, I will create multiple records. Let's say second one is John, UK, 50 thousand and 40-years-old. And I'll create one more rule, which is let's say Germany, 20,020 years old. Okay? So in database, this is called table. In database. This is just understanding the database little bit. So this is a table. So this whole thing is known as database. Okay? And whatever is in the this SN name country income is, these are the columns. This will be also helpful later when we talk about Pandas and stuff like that. So make sure you understand this. So SN is a column, name is the column countries, the Colosseum and income is the co-domain, is the column, right? And this also we know as the volume. We can also know as variables and database. And the room like 123, the rules. The rules are known as records in database. Okay? So in the concept of crude, we must be able to create in our program, we must be able to create something means we must be able to create the whole record table. Create means that table create is for the table. The table. And read. Read can be also read can be both table variables and records all update. And create also means that we must be able to create the table itself only the table. And the update will allow for the variables and record. Meaning update means that we can add one more column into our table. Or I can add one more rule like this, right? That's update. And delete can be for all those things that it can be for. Cable also, variables also records. Awesome. So as I said, variables is called him and record is the rule. So that is how we understand the crude and that's how crude works. Now, in the next episode in the dictionary, methods will be using dictionaries. We'll be using just to show you some hints. So for example, let's say our dictionary as the database. We will have the information here. So for example, we will have S, n is one, right? Mean is, let's say Henry, something like this will create a database on our database, on our dictionary. And then we'll be using a dictionary methods to create, read, update, and delete. That's why you had to understand what good is. If you didn't understand, you can go back and check this video again and you'll get a better understanding of this. So I think we'll be looking at the dictionary methods in the next episode. So I'll see you in the next one. 16. Dictionary Methods: So as we understood the crude concept and what crude is the create, read, update, and delete. Now we'll be looking at the dictionary methods. So dictionaries, like how I call it dictionary methods, it's not really methods like you remember in the string and list, it's, it was really a method like it would use dot notation and it would be done on the thing. But this is not really mattered, but this is just to understand it as a method. And we'll be looking at how creative we can create into dictionary, how we can update into the X-ray, how Greg and read into dictionary, and how we can delete from dictionary. Dictionary also works as a database. So this can be really helpful in this case. So for example, I'll just create a dictionary. So for example, let's say I have a dictionary called db, and it has a dictionary key value pairs. So something like, okay, let's see. Um, I don't know, maybe mean equals something like this. So name is hungry, right? Is, is, is, is, let's say 40. We had another one concrete, right? So let's say country is us and our income is, let's say a 100 thousand. Okay? So let's say that's our database. And that's actually we created our database table, right? So that does create parts. So create is not much actually, it's just creating into a database. So we just created it, right? So the database is created now. Now we have to be able to read it. To read it, there can be multiple methods. So we can firstly read, as you were told, we can read the table means the dictionary, dictionary itself. Or we can read the variables, means the columns. In this case the columns are the keys, right? Because you remember in dictionary key and value, name is the key, Henry is the value. So that's why we have to know it as Keith, right? Because in dictionary there's nothing as columns or variables or records. It's a ski and value. And another part is we have to be able to read. This is just the real part, okay? So read the records or rows. Or in this case, this would be our values. Those things. Alright, so do read the database, the whole table, the dictionary, we basically printed the database. I mean, the dictionary. If I just do that, you can see it just printed. So everything in the whole, whole thing is soon. Now, let's say I want to just read the variables. Means does the keys are columns, right? Just name is country and income. So in that case, what I would do is I would say print. There are multiple methods to do it. One is to say print db dot keys. Now this is also a method, right? Dot keys is a method. If I run this, you can see it will create a list of dict keys desert from a dictionary containing the list of all the keys. Name is pantry and income, name is country and income right? Now that is one way. If I want to saw it in one-by-one, the line-by-line, we have to use something called for-loop. We have not learned the loops yet, but I'll just try, try to show it to you so that later on you can understand. So I would just go into the database dot keys. So in the list I iterated. So for i means for each element in db dot keys means for each element, I would just print those elements just like that. I, because I is the elementary. So in that case I would just get line by line, just like that, right? So that is how I read into variables, keys. This is with the concept of for loop. This is without the concept of for loop. So if you understood the for loop, it's fine. Otherwise we will learn it in the next episodes. I think in the next section we'll be looking at the four loops. It will come after sometime. Okay, now that we have our read the, read the keys. Now let's look at how we can read the values. Just like we did with the db dot keys. We can see the dictionary dot db dot values. That is also a method that we just read, the dictionary methods values. You can see it's a dict of values and it has the, all the values in it, right? So if I were just want to print it line by line, also, I can do it for I in dB values. And then I just print out just the same thing that I did up there with the keys is the same thing with the value also. Just here you can see Andrey, 40 US and a 100 thousand re. So that's how I do it. Let me just write that also, db dot values. So these are the two ways to read into the values. Yeah, both of them. That's for the read. Now I think that's how we read everything. It has covered everything. Now, let's talk about update. Now. As you saw that already, that update is for last time we talked about in previous episodes. Update is for we have to update variables. We have to be able to update variables and also update. Update, update the variables means volumes means keys, and update the records. Record means our roads or break. Okay, let's look at it. So we have a DB. Let's say I want to change is, let's say country into country code. Then how can I change that? For us to do that? What we have to do is we have to identify because it's like this. The record is already created over there. I cannot just update that particular record. I can just change the value of that record, but if I want to change that record, I have to firstly delete that and then create a new one. That's the only way that I can do it. So I have to use delete method. So we'll come back to that later. But let's say I want to update the values. Now for the keys we have to use, use the heat so we will learn how to delete and then we'll come back to this. But how to change the values? Let's say I want to change the country to something like, let's say UK, not us, but you came. Then what I can do is I can use something called King method. So I can use the db, which is our dictionary, right? I can use the scheme method. I can call that country because I want to change the country. So I would have to put that country. We're basically identifying this element here. By that. We get that element and we change that value by saying equals, right? And if I print that dV, Now, previously the DB has the value us, right? But now if I run it, you can see it has been changed into UK because I did that. If I changed it to Canada and run it, then you could see it's Canada, right? So this is how you change, update the values. Now, as I said already, to update the variables, the keys, we have to understand how to use Delete because I can't just change country to country code or something like that, changing the keys like that. But what I have to do is I have to delete this whole element, and then I have to add another element. So that's what we can do. For that. As I said, we have to understand delete. So let's look at delete. So we have to be able to delete what? We have to be able to delete rows, columns, which is variables. But we cannot delete the rows. Sorry, just the keys because these are assigned to each other, right? Is, is assigned to 40. So if I can remove 40, then it means is it's also gone right? So it can't be empty. Obviously, I can update it to null or nothing, right? None. But then I can't delete it because we have to replace it with some value, otherwise the whole elements would be deleted. So that's why we can just delete the keys. To delete the keys, we have two methods. One is to say del and our key. So for example, let's say I want to delete the A's. Sorry, Let's say I want to, because we want it to do that. Let's say I want to delete a country. So I can say del. And then I can say db country because that's our element, right? That's how we choose our elements just like we did here. Also, if I say del db dot db country, then if I print that dictionary, you can see the country is normal there, right? That's one way to do it. There's another way to do it also. Lets say I want to also delete it from there. So I can do that by saying db dot delete country, sorry, sorry, this is not db.find delete but remove. Anything not remove also. Cannot. Yeah, Bob, sorry, I was wrong. We have to use pop. So db dot pop. And then if I print the DB after that, then you can see there is no ys, right? So dot pop is used to delete the columns also, sorry, the keys also. We can use also del, and then we just say that. So both way is fine. This is how we delete a particular record or a key value pair right? Now, using this, now we deleted that. Now we have to update our keys, right? Because we wanted to add a country called us. That's why we can, what we can do, we can use the update method, right? So we want to create a new value. So to create also we can do this, that we create another one which is country code, let's say equals us. Right? Now you will see that it will add country code here, right? Because we did it up here. That's why it's going from up, up, up also. But this is how we create another column. Also, update also, and create also. If I want to add one more, I'll just do like this, right? So whatever I want to change or add. So here what we can understand is addition of a key and update of the key are both done in the similar way. Just that if the key already exists, then it updates. If it does not exist, then it creates, right? So that is how we create, update and delete in a dictionary. And this is how we use dictionary methods and manipulate inside the dictionary. This will be very helpful in coming episodes. So the next episode we'll be in tuple. So I'll see you in the next one then. 17. Tuple: Episode we looked at dictionary methods. We looked at how to create, read, update, and delete. Now in this episode we'll be looking at toppled. Now, if you remember our past videos, you might remember what tuples are. Tuples are those values with normal bracket and separated with a comma, right? 123, something like that. And if I want to create a tuple with a singular element, then I have to not just say one but one come. Edward, create a tuple. So offer singular, otherwise it just that 123. So for example, this is the thing. Now, we have to understand what is the use case of tuple because we know toppled is there, but why do we actually use it, right? The main case where we use it is because tuples are immutable, which means that tuple cannot be added. So for example, I cannot say a dot append or add into tuple. I cannot add an element into trouble. So once it's created, it's created, we cannot change it later. That's what immutable means. We can't mutate it, right? So that's the characteristic of tuple. That is immutable, means it's not new table or it cannot be mutated, right? So this means I cannot change anything in tuple. So once it's created, it's created, I cannot do anything about it. So that's why tuple might be helpful in something like things like username, password, right? This need not change rate. It should be the thing that it is, right? It should not change. So in such cases where we need to make it private and not accessible and we cannot change it. In such cases we use tuples. Okay? So that's where we actually use tuple and that's the use case of w. Now, for example, I cannot say a dot. Now I can obviously say count because I can see that's a tuple method. Now, if I just have to false and then if I see a dot count and print, some other methods work, right? And indexing methods also works. So for example, if I want to get three here, so what I can do is print E and then indexing so 012. So if I say two, then it will give me three, right? Because it's in the index value of two. So that I can do. Other things that I can do with tuple is I can check the index value of it so I can see what the index value of three. I can see that I want to print this order. So if I run this, you can see I can get the index value of it. Something other things that we could do is here we can see all the things that we can do. But these are the main things that we can do in two tuple. Now, if I want to add, for example, if I want to add it, there is one way to do it. So if I say this is called dunder, so double underscore, dunder, dunder, Add. And then I can say, let's say seven, right? Then if I say print a, sorry, I want to add seven columns. So you can see it did not change anything because it's like this. What ADH does is basically it adds up into the itself. So if I print this and run it, run it, then only I can see it right? So it does not actually change E Rate eight remains itself. But in some cases, like where we need to add something temporarily in the a, it does not change E actually, but it just now temporarily then we can use dunder ad. So that's what we could do. But then again, it does not change. It changes lists, dictionaries. We cannot change natively the E or tuple, but we can temporarily change it and add it like that. So that's the thing about tuple and other dunder methods that we could use r. So we have ADD, we can also see what contains the right, does it contain there or not? So that is the thing. And we can also get items. So for example, if I wanted to see, okay, I want to search for some item there, then I can use get item. So that's the benefit of having pie chart that you can see many things that can be useful and then you can use it. So for example, I can also, and also there is one thing called doc string, which will also learn in object-oriented programming. But docstring can help you in finding the dock. So it's called documentation. It'll show you how you can code. This can be helpful. Other things that you can do with tuples are you can also say Help and then E. So this will give you a basic documentation of tuple library, I mean, things. So you can see all these help. So what are there in tuple? This is exactly how when PyCharm said, suggested this. This is how we fetched those information. So it went into the help and then saw, okay, That's, that will return the filtered value plus value. And also it contains, so all these things are here. So if you wanted to see okay, what you want to try next, width tabu, then there are lot of things you can try it here, and then you can do that also. Similarly, this not just with tuple, but you can do it with dictionaries also. Like for example, if I say a is dictionary and then if I print the help of B. And I can see what I can do with the dictionaries like the methods that to pop keys, items. These things we did right-click copy, if you remember, that's part, read it. So all these things we can do, any, any value you have in Python if you just say help bracket and then that value, it will show you a documentation of what you can do with that. And then you can just play around with the code. So for example, if I have, let's just give an example. So it equals a tuple which is already a double. So if I say print, help it. So later on when you are quoting more things, then if I see, Let's say monk, right? So what I can do is I can say a dot HTML. And then I will just want to multiply, okay, so six, right? And if I print this, remember this does not change itself. I have to print it. This is like a temporary value. It does not change whatsoever. So you can see it is six times three. So 12344123441234446 times. So that is what ML does like. If I just say two, then it will just say two times three, Something like that. So you can try to play around with the code a little bit, practice a little bit with tuples also, because this might not be used that often, but it is quite used in the programming area. So you have to get a better hands-on it. So the next chapter we'll be looking at is for sets. So this is another topic for Eddie. And then once we cover that, I think we will cover all the datatypes and then we will be going into operators. I'll see you in the next one. The sets. 18. Sets: So in this episode we'll be looking at sets. And what is sets. Last episode recovered the tuples and dictionaries also, this is set is one of the areas. You remember the areas. Let us revise those. So we had a ray and we had five types of theories. One is list, second is what was it? Tried to remember that list we had, we had tuple, we had dictionaries and sets. And finally we had lists, tuples, dictionaries. What else did we have? I think we had full right, butt 54. Yeah. That's it. So we talked about lists also. Last episode we talked about tuples, dictionaries, methods also we talked, now let's talk about sets. What is set actually and how it is used, and what are the use case of it. And where is it that we use actually sets, right? Let's look at it. Sets have also its own, just like tuples are immutable. Lists are mutable and subscript w. So this means they have their own property. They are immutable. You're right. And dictionaries have key value pair. That's what they're known for. Tuple are known for immutable illness. Now what is set known for? What is the benefit of our use case offset? Now, usually we use set whenever we need to. The mean use-case of our characteristic offset is that it cannot have duplicates. Duplicates, right? That's the main advantage in application offset. So for example, let's just give an example. If it was a list, I could use just 1234455. This is possible in Illustrator. If I print a, then it will just print like that. No problem. Sets how we write set is it's similar to dictionaries, but it just does not have key-value pair. We can write sets like this and we separate with comma, alright, One, 23 like that. And we can say d equals this. And we can say basically that, okay, B is the set 12345. And if I say, let's say I have duplicates like 12344, then if I print b, then you can see there is no duplicates, right? There's no multiple, anything, right? In the assignment. I did put that for double, but you can see it's not there because sets are known for no duplicates. Like it cannot have duplicates, right? That's the main character of sets and that's why we use it. Now, what is the advantage of other things can we do with sets? Yes, absolutely, we can do. So. For example, I can remove an element from the set. So if I want to remove for, let's say, and I can change, unlike tuple, it will change the whole element itself. It'll change the beat itself, right? Just like that. You can see the food is taken out from B. And I can also do B dot add. If I want to add, then we don't do a bend here. We do a lot at okay. So if I wanted to add, let's say again full, then I would just say b dot add and then print B, right? I just do that. And just like that we added for, right. And similarly, we have other things that we could do with dictionaries sets is that we could pop also. So I can pop the elements. We can union. Union means we add two different sets. Okay? So for example, I have another set which is, let's say 678. Now. But if this contains, so if I print b, you can, sorry, we have to print this whole thing. This does not change the mean be. So you can see 678 is added, but if I had the duplicate, so for example, four comma six comma seven, comma eight. They need to not added duplicates. Again. Just to remember this, that sets will not have any duplicates value, it won't contain any duplicate values. So that's the main thing about set. Otherwise, again, you can just say print help of B. And then you can just see, okay, what, what else you can do from the set point of view. And then you can just write remove Bob is upset, right? Subset or not. We can check if that is a subset or not of that rate. So things like it, we can do everything. So I think that's it for sect. In the next episode, we'll be looking at operators now. I think our datatypes are finished. So we'll be looking at operators and we'll be going into logical operators and automatic operators, lot of operators. I'll see you in the next one. 19. Arithmetic Operators: So in this episode we'll be talking about operators and what are operators? And specifically, we will be covering the first operator in this video. Alright? Basically, let's understand what operators means in the first place, right? So what is operator? By definition, operators means those things. Those values, are those Anything, anything that does the operation. That's what operation, that's what literally Operators, meaning. Now, what is the use case of operators in Python? In Python, what we're looking at our different operators that can be used to operate in two different conditions. So we have principally full kinds of operators. And those kinds of, all those four kinds are one is arithmetic. Arithmetic operators will be going more into detail for arithmetic operators in this video. The second one is assignment operators. Assignment operators. The third one, you can write it down also. So the third one is comparison operator. And the fourth one is the logical operator. Now, we'll be going each in the details. So next video we'll cover for the assignment operator. The following video will be on comparison and then following will be on logical. But in this case, we'll be looking at arithmetic operators itself more in detail. So as I said, operators are those things. Now that actually does the operation. Now what kind of operation? And that operation is arithmetic operators. Operation in this case, for the arithmetic operator may take operator will be doing arithmetic operations. And what does arithmetic operation means? This means any kinds of mathematical operations. So for example, if I want to add two numbers, that is a mathematical operation. If I want to add, subtract, delete, sorry, I add, subtract, divide, multiply. Those things are known as arithmetic operations or mathematical operators, or operations. And the value is that symbols that we use to do these are known as arithmetic operators, for example. So plus is for add, minuses for subtract divide is this, multiplies this. Now we can not only at this but many more like exponentiation. Exponentiation means to the power of exponentiation as well as modulus. Modulus. Modulus we can say, alright, we also have, for example, let's say greater than. Sorry, that is a different thing. Yeah. So exponential modulus and other is we also use double division also. For example, for exponential notation, we use double this mark, right? And for modulus we use this mark, percentage sign. And for a double division, we use this. Now, let us try to print all these in C, each of them. So if I want to add five plus five, then I can do that with the plus operator. And that is an arithmetic operator. Plus is in automatic operator. I can also subtract five minus five. So this means minus is an arithmetic operator. I can also divide five by five. So this is also divide is an arithmetic operator. Similarly, I can exponentiation. I can do five to the power of five. Alright? That is also exponentiation is take operator. And similarly I can do modulus also. So fight mode to, let's say can do that. Similarly, I can do double division, so five, right? Okay, so let's just run this. And I think pretty much it's simple. And we can see the answer. Five plus five is 105 minus 505 by five is 15 to the power of five is 3,125. And I think modulus and double division can be new for some people. So modulus is the thing that shows us the remainder. So for example, when five is divided by two. When five is divided by two, What's the remainder and that's one, right? If I hide use full. Then when four is divided by two, there is no remainder. Remainder. When I divide 54, we can divide, but there is one meaning. And that is the value, right? The remainder. So that's what modulus does. It basically sends out remainder when the, you know, the first number is divided by the following number. Alright? That is for that and double division is for removing the points. If I had just used one divide, then that would give us 2.5, because five by two is 2.5. But if I use that, then it will just neglect whatever is after 0.5 and that will just print just like that, just to, right? So that is how we use some of the operators, some of the arithmetic operators. And this can be helpful for you as well. And this is about the arithmetic operators. Basically again, trying to understand this whole thing. Again, that arithmetic operators are, those operators are symbols that are used to do mathematical values are mathematical operations. For example, add, subtract, divide, numerical operations. Those things. Now here we don't use greater than, less than sign that. That would be another one. That is assignment operators. So we'll talk about that in more in detail. Alright. So in the next episode, we'll be looking at the assignment operator. And we will be looking at what kind of operators we have to assign. And those things. Other than that, I think there is, there are obviously many more arithmetic operators, not just this, but these are the ones that comes to my mind just now. But there are other also, again, anything that does mathematical operation, that itself is arithmetic operator. That's the basic understanding that you have to have. Out of four operators. We have covered the first one, which is arithmetic operator. Now we have the second one assignment operator and third one comparison operator, then fourth one logical operator. So we'll be looking at assignment, comparison and logical operator in the next one. So stay tuned for that and I'll see you in the next one again. You want to practice this again and again. You want to try to see what clusters but minus does, but divide us what exponential insulin does. What modulus does you want to try to change the values a little bit and try to play around with the code rate because that will help you to understand the cold much better. And also with the double division and also you can go into the Internet and search for different things that you can see in the Internet like different arithmetic operators. You can just open Google and type in arithmetic operators. You'll see bunch of different things. And so that's what you can do. And I'll see you in the next one. 20. Assignment Operators: We looked at the sign, sorry, arithmetic operator. Now in this episode we'll be looking at the assignment operator, which is the second of the four operators that we discussed. So again, coming back again, just revising everything. Operators are those which operate, does any kind of operation. In the case of arithmetic operations, it was the mathematical operations. Now, in the case of assignment operator, what are those? Make me write it down here. So assignment operators, now the, as the word itself sees, it has to do something with assignment. Assignment does not mean the call is assignment that you have, but it means to assign something, to assign one value to another. Assignment operators can be something ranging from equal to, right. So what we're doing is we're saying, okay, that is, this is equal to that. Or we have basically, there are not much assignment operators. So this video will not be that long. So one assignment operator that we use is equal to, so for example, a equals ten. And another thing that we can use also is the opposite of equal, which is not equal. So we are now looking at is not equal to ten. And this will be not an assignment operator now, but this will be another operator that we'll be covering in the next episode. And that is comparison operator because it compares a and ten. So that's why it's not an assignment operator. I'm just, I just wrote it to show it to you and make it for the next one. So in the case of assignment operator in Python, usually it's just equal to, but they can be also, but usually it's just equal to because that's how we assign a value to another value, right? So that's basically it for assignment operator, there is not much actually, just you have to understand what If you are, if the operator is assigning something, then that's our assignment operator and that is equals. So in the next episode, we'll be looking at the comparison operators. Comparison operators, and they can be more than that, more than just one. So we'll be looking at Duke comparison operator in the next episode. Then I'll see you in the next one. 21. Comparison Operators: The third operator that we have in our list is comparison operator. Now, what are comparison operator? Now, as the word itself sees, like, like we did with the arithmetic operator and the assignment operator, we knew that arithmetic operators are those operators which are done on mathematical values. Similarly, assignment operator, we understood that these are the operators that are used to assign some values, right? And so what is actually our, the third one is, so in our third one we have comparison operator. So what is comparison operator? Let's look at that. So as you know already, operators are those values that operate on something. Now, in this case, it is to compare, comparison rate means to compare something. Now compare what? So all of these, what you have to understand in the comparison operator is the returning value will not be any kinds of numeric value or anything like that. It will be a Boolean value. Returns a Boolean value, also known as Boo. Alright? So for example, what are the examples of comparison operator? Because we want to compare between two elements, two values. As we already said in the last episode, also in the assignment operator, we talked about it's not equal, right? There is equal to equal, equals. So it's not equal to, it's not that, but it's trying to compare. Is it equal or not equal? Three, not equals. And we have greater than. We have less than, less than. We have greater than or equal. Greater than or equal, and equal. And we have lesser than equal. Right? How would we write this is for the equals we have double equal to, but not equal to. We have exclamation equal do. And for the greater than, we have obviously this one. And for the less than, obviously this one, right? And for the greater than or equal than, greater than, or equal, less than or equal less than and equal like Doc right? Now for example, let's say, I want to say is five equal to five? Then if I print that command, these also take it out. Okay, if I run this, you can see it's true because five equals 55 is equal to five. We're comparing two values here. For naught equals then if I see is five is not equal to five, that is false because five is equal to fall flight rate. So that will give us thoughts. So as I said, it only returns a Boolean values now greater than. So, I'm just trying to check whether four is greater than three are not. In this case it would be true just like that. And I wanted to look at is three or four less than three are not, right, that would be false, right? And similarly for the greater than equal, that word, it's a similar, it's a combination of greater than and equals three. So either it is greater than or equal to, it will print out true. Meaning, if I say five is greater than equal to five, then that would be true, right? Because five is not greater than five, but it is equivalent to five frame or something like six is greater than N equals. That will also be true because six is greater than five, maybe not equals greater. Alright? So that n Similarly with the less than equals also is the same thing. It's a combination of less than and equals. Something like three is less than or equal to three will be true, right? But then three is less than or equal to would be false, right? Just like that. So that is how we operate between comparison operators. Usually how we use this comparison operators later on in, After we complete the logical operators. After one more video, the next episode we'll be on logical operator. And then after that we'll be looking into if else statements. For those conditional statements. This is widely used. So that's why you have to have a good understanding of these to understand conditional statements. So I want you to practice this a little bit. Try to work around, try to change the values. What you can also do is you can have two values like e equals five and b equals ten. And then you try to say it is a equal to B. Is a not equal to B? Is a greater than b? Is less than b? No, maybe I want to change that narrative. Is b greater than or equal to a and B greater than, less than or equal to a. This also works because it's the same thing that, but then we just changed the values into a variable. So it's not much different. I'm just trying to show you how you can play around with the code like this. You can try and test yourself out how things work in programming. Because as I already say, and I keep saying this in every episode, that practice is key, right, in programming. So I would want you to practice more and more and more and more and you will get a better understanding of it. So next episode we'll be covering, we covered all three of them, the operators. Now finally we have the fourth logical operator. And here we'll be looking at the logic part. Yeah, so that's it for me in this episode. I'll see you in the next one. 22. Logical Operators: Looking at the logical operators, now, we have covered all the three operators that we were talking about. The first one is arithmetic operators, second one was assignment operator, and third one is comprising a program. Now in this episode we'll be looking at the logical operator and what's the use case of it and how do we actually use it? Now, again, if we want to know what logical operators are, you must know what comparison operators are. And in the last episode, we talked about that. And we knew that comparison operators always return a Boolean value, right? It was the main thing, just like that right? Now. Logical operators are operators that are done, are used to operate between two Lasix. Lasix come from the next episode that will becoming talking about, which is conditional statements. And basically, conditional statements are used the Lasix to specify whether to do a coordinate, right? So if something then do that, right? So in those conditions, in those lasix, we can operate between two conditions. We can say, okay, either this or that, or both of them in such cases. So let's look at the logical operator. And logical operators. A little bit tricky to understand, and you must pay attention a little bit. And if you need, I would bring them in to take some notes. Now the logical operators are those operators that are used in order to make sure that you have proper conditional checks. So this means that you are trying to see whether or not two or more than two conditions collide with each other or we are basically trying to operate. And as you already know, those conditional statements always return a Boolean value. So basically what you can understand for now is that we are trying to operate between two Boolean values. Just that. Now there are two logical operators in bitumen. Depending upon the programming language that can be more or less, it really depends. Now there is our n, and so these are the two logical operators that we have in Python. Okay? So based on those two logical operators, we can basically combining see which logics really feed rate. So that is the whole idea of logical operators. And we were looking at what kind of, you know, how we actually use logical operators in just a bit. So just to understand here, we are trying to operate between two Boolean values. For now, you just can understand Lasix as the Boolean values. Later on when we talk about conditional statements, then we can see how it actually works in the real world. But for now we're just having the basic understanding of the laws, globe logics, right? So you can just say that logic, operators or lasix, we can see these are the Boolean values. Just for exemption, this is not actually, but just for assumption or which we can basically say true or false. Okay? So let's see. Now. Now the thing comes about, there is something called truth tables. Truth tables. Now what our truth tables. Basically, those are the tables that can show you, okay, what is the output when we operate between two logics? So for example, distract you from the example. Let's say I have, okay, Let's see the truth table of all. Our truth table. I'll just make it a comment so that it's easier. So this is for the odd. Now, if you go back in the computing and circuit board, then you will have many kinds of tables. And these are actually natively created from transistors in the circuit board. But here we are trying to learn software development. That's why we are talking about it in the software point of view. But actually there are multiple tables. There is R, there is exclusive, or there is an exclusive end. There is not, right? There's lot of, we also call this as gates, logic gates. So we can see it as logic gates or truth table. Okay? So in the truth table, true or true becomes true. This is just a basic understanding. I'll go more deeper into it. But just to understand now, true or false becomes true. False or true becomes altered true, and false or false becomes, okay. So what we have to understand here is that at least if there is just one true, then everything will be returned as true when we. Work with R. So if just one is true, this one is true, then that means it's true. So for example, if we have three operations going on, so true or true, true or false or false, though there are two falses, at least because there is just one true, it will return us true. So that's the whole idea of truth table. For the, for the use case off. Here, we're just looking at the two tables. So that's why just for the, there's not try the end and we'll come into later. So there's just perform. This applies to home. Doesn't matter the number, how many you are working with the lasix or the conditions. Those if just one is true and all of them are like we're operating with all, then that will return us true. Okay? Now, if all of them are false, that's the only case where we will have false. Okay, that's the basic idea of it. Now let's look at the end table. Now, entry table is a bit different. And true table edge, I would say just the opposite. So let's see the truth table first and we will describe it. So true and q becomes true, true and false becomes false. False and true becomes false. And false and false also becomes false. So you might have already guessed it. Yes. In the entry table, whenever we are using end, we have to have all of them true. So not just one or two or three, it has to be all crew in order to give true if they're just one false and that would be hold false. This applies to whether you are doing with multiple, like more than two also, so true and true. And though there are two truths, but if there's just one false, then this will be false. So here what we can understand from logical point of view like from our understanding, how we can understand this is that, so for example, in the case of r, So we are saying either this or that, right? So for example, let's say, let's look at an example. Example. So let's say I have a cup of tea. Cup of tea. And I have, I have two choices. I have a cup of tea or I have a cup of coffee. And if any of them are there, then that means I will drink, drink it, right? So the thing about drinking will be true. So if there is a cup of tea and no cup of coffee, then I would still drink because there is a tree. But let's say if I don't have D and I have a coffee, then still I will drink it because I have a coffee. But let's say I have both of them are there's nothing right? Then in that case, okay. Then I can't drink, drink, drinking becomes false. So that's the whole idea of Art. And in the case of end, we, I have to have both. So for example, let's say I have this as an example. So let's say I have, I don't know, maybe the street and wine, let's say pastry and one, maybe. I don't know how many of you find good combo or bad combo. I don't know. But yeah, just what comes to my mind, Let's say I want to have both the Austrian monk, why I can't go without pastry and white at the same time I need those, right? So this means my intake will be based on these. I have pastry and no wine. Then that means I want drink it because our ET rate, because I need both of them to satisfy myself. Or let's say the vice versa. I don't have peasantry, but I have wind and I won't drink it because I need both, right? Only when I have both, then only I will drink it, right? So this is for the n keys. So this is how you can understand. I'm just trying to make you a little bit understand what it really is and how you can understand the truth tables. But this is how the R and end gates work or truth table works. So you can see it in practice also. So for example, let's say I have crew. So if I print that, you can see it's true. I will just comment everything from top. Okay? Yeah. Alright, So I'll just run this. You can see it's true. True or true. Is true, true or false. Is false. True, because at least one is true, right? But if I used, and then you guess just write that at least all of them should be true in this case of n. So that means it will give us false. And this applies to three also. So true and true and false will give me false because there is at least one false. But if all of them are true, then that would be true. Alright? So we're trying to operate between conditions here, sorry, Boolean values. And later on we will replace this with conditions in the conditional statements if else conditions. So that's what we'll be doing in the next episode. We'll be looking at the conditional statements. I hope this is clear for you, the operators, because operators are quite useful. Like you have to be really like digesting this before we jump into the conditions and conditional statements like if, else and for-loop also. Because at the end we need these operators and we have to manipulate these things. If it's not clear, I would strongly suggest you to go back, rewind this video and watch this again so that it is clear for you. And I would suggest obviously to point out all these things and make sure that you understand it with examples. Because truth tables are a little bit, you have to use a little bit of your own logic to understand it. But once you use it, then it will be fine enough. So I would suggest you take notes and practice it just like that printing true and true. What happens, right? Just trying. Also, like, I also wanted to show you the combination of two different operators. So for example, let's say I have print, true or true, okay, that means true. I have now. Okay, So what do you think? Does that give for us to understand what it gives, we have to separate these things. So firstly, I have to, what computer does is what Python does is firstly, it goes with the starting. So true or true is true. This means it remains true. And then we have the remaining, which is true and false. And true and false means false. So that would give us false. Sorry. In order to do that, we have to use something called isolation. Sorry, I was a little bit confusing. So we have to use isolation in that case, but by default we have true. Why is it true? Because see, what it does is basically it goes from n. N is always considered the highest form of the truth tables. So firstly does true and false is actually false and true or false remains, then that means it's true. But let's say I want to have not that weird own, but I want to do this to operations first. Then I would use something called isolation. I would bracket it up, then I will run it, then I will get to false. So that's the technique of isolation. If you want to do something like that, then you would need to use brackets to specify which you want to do. First. If you use brackets, then you would be able to isolate that and then that will be executed first. So yeah, that's how you execute multiple different operators at the same time. Logical operators. This where all four operators, and I would suggest you do again, as I said, take notes and practice it a lot, and then I'll see you in the next one. The next chapter will be on if else, conditions and conditional statements. 23. Conditional Statements: The operators. And as I said, the next chapter in the previous one would be on conditional statements. Now what are conditional statements? In conditional statements? The two operators, the last two operators were to come handy. If you remember the operators, we had four operators. One word bathymetric. Second assignment was comparison, and fourth one was. Yeah, so in conditional statements will be using the comparison and logical operators. So conditional statements are basically if else clauses. Meaning what happens in computer is that if this clause is right, then we do certain things, right? If that is not right than we do other things. So that is the whole idea of conditional statements and that's what condition actually mean also, right? All right, then let's just jump into it. In conditional statements, we have three cat, three things. One is if we put our condition there, then we separate this with Colin and one indentation, one in addition is always one tab. Or for species 1234, Either that or just one tab, right? And then here we'll execute, execute code when condition one, let's just say this as condition one is correct. And we can have elif. Elif means, okay, if that's not correct, then it comes down to a leaf and it checks for condition two. And execute. Execute, execute the code when condition two is correct. And we can have as many elifs as we want depending upon the situation. I have another condition, condition three, and I can execute the code when condition three is correct. Okay? So basically what we're trying to do here is basically trying to check okay. Condition one, correct or not. If correct, then just do it so it won't go to down. Otherwise, if that's not correct, then go to another one. So it checks for condition to an if that is correct, then executes this. If that's not correct, only, then only it will go to a condition three. This is why because it flows from top to bottom. That's why this is also known as sometimes as control flow. Control structure. Some way you might see it also control structure. We can also say it because it goes into the floor right? Now. If none of them are correct, then it'll run the else part. So execute if none of the conditions are correct. Okay. And how does Python know if that is correct or not? And that is by using the values or Boolean values. We've talked about this already. Also. It will check for Boolean values. So it'll check whether it's true. If it's true, condition one becomes true, then that means it should execute. If that becomes false, then it goes to another one. So think of it as a trigger, a trigger for conditional statements to see okay, if that is correct or not, right? So that is the whole idea of conditional statements. Now, let's see if that is true, then that will be executed. If that is false, then it goes to L if condition two. And again, see if condition two is true or false. If it is true, then it will stop here, the execute whatever it is inside here. Otherwise, if it is false, then it'll go to condition three. Again. Does the same thing. It will check for condition. If it is true, then execute here. It does not go down. Otherwise if it is false, then it goes down. Now, else does not need to have any condition because LT is the part when none of the condition match rate. So that means if all of them are false, then execute, the else will execute right? Now, Let's see this as an example. Let's just syntax and let's look at it as an example. So let's say if condition one, then I want to say print condition one is true. Condition two, I want to execute that condition two is true. Similarly, I will have to use condition three. And print condition three is true. Or else does the same thing. None of the conditions are true. Okay? So if I just run it, it'll give me a syntax error because it does not know what condition one, condition two, and condition three are. Let us say this is true and all of them are true. Let's see what will happen in this case. In this case, print condition, what is true will be executed because. It'll say, Okay, that's true. Then it'll execute this and it won't go down, right? So that's why it'll just say condition one is true. Let's say it was false. Then what would happen? Then it will go to 1 second 1 and see, okay, that's true. Then print that rate. So it'll go there because it is true already. So it won't go to the another group because that's already found. And let's say this is also false, then it will go to this one. And that is true, right? So condition three is true. Let's say all of the conditions were false. Then it'll go to the else part, right? You can see how it flows from top to bottom, right. Like it goes from the first condition, the second condition to target listening to. If none of the condition matched then twelfths. Now, this is just a tentative idea of how conditional statements can look. I think what you can do now, right now is go ahead and code this on your own. If you want to try to play around with the conditions a little bit, try to put true, false, true, false. Change a little bit and see yourself how it does. I'll give you like a moment and then you can pause this video and then you can try this. Alright? So I think you have tried this and you're good to go. Alright? So now that we know how to use if else, if else condition. Now let's look at it from a proper point of view because we can just say true, false, true, false like that, right? We need some kind of dynamic value. In such cases, what we do is we will use comparison operator. You remember how we use comparison operator? Just bring those things back just to revise. If you had note, then it would be easier. Comparison operators is like a, b is greater than b or five is equal to five like that, right? Those are the comparison operators. So what we can do is we can create such thing. So for example, because you remember that five equals five always comparison operators used to return a Boolean value and that's what we want here. We want it to return a Boolean value so that our control structure again work, our if else condition can work. So that's why what I can do is I can save this with five equals five. And that is true, right? So that means this will be executed. So just like that condition one is true, because that became true, great, because five equals five is correct. If I see, if I is not equal to Correct, Then that is false. So all the other things are false. So that means it will go to the else. Just like that. Let me put another one which is, let's see, six is greater than five. And that means condition true is true, right? Because six is greater than five will return us true. So that's why it will go like that and lift false. I will just say greater than, I'll just change it to less than. That would be false again. Right? And let me put it something like one is less than or less than less than or equal to ten. That would be correct. So that means candidates in three is true. Alright, so this is how we can replace our comparison, I mean, our Boolean values with comparison operators and we can compare between two values. Now this is not that useful. For example, in real-world scenarios, we can't really use it. So we will try to understand it from a real-world point of view and try to solve a real-world question. So our question would be now, given an ACE. So we have given an ACE. So find whether a person qualifies for a driver's license. And the qualification is that he should be greater than or he should be older than 16 years of age. All right. So that's the qualification. Okay? Now, as of now this, we are now trying to go into advanced kind of programming rate. We're trying to shift ourselves from basic foundational principles to actually building real word codes. So that's why I think you have to pay attention here. Okay? Now, whenever you're given a problem, the first thing is to identify and read the problem as much as you can so that you understand what it really means. We are seed that given an age means is as given. So that's why we can define a nice like we can give is, let's say 19, just for assumption. So find whether a person qualifies for a driver's license or not. We have to check whether he is his age is greater than 16 or not. Right? So we can say if the age is greater than 16, so that means he qualifies for it. So that means qualifies. For the driver's license. Otherwise means we don't need elif here because we don't have second condition because we're just working with one condition in this case. So if it is greater than 16, he qualifies. Otherwise this does not qualify. So that means we can just go into else. So see, like what we have to understand is elifs and else's and not really mandatory. Like it's not like you have to put it when you need it, you have to, but if you don't need it, then you don't need to write. So else then you can just say he does not qualify for a driver's license. Okay. Now let's run this. I'll just comment this part. Okay. Think that become ended. It's run it. So it says he qualifies for the diamond slaves and because his ease is greater than 16 rate, let's, let me see. Let's say 12 and he's disqualified and that's what he does. He does not qualify for a driver's license. Now, what happens if I see 16? That also says does not qualify because 16 is not greater than 16. Right? So that's why let's say I want also the 16 years old get to also have the qualifications. So then what I can do is I can use the comparison operator, greater than equals, right? So either he is greater than or equal to 16, then he qualifies for it. So that we'll just do that. So that's the basic idea of how we apply our knowledge of if else conditions into such things. Now, I will give you, I would like to ask you to do the same thing. You can just watch again. You can just try to do it on your own. And I will also leave this episode with one question for you that you can practice. Okay? So let's say I have, Okay, I will give him a question here. So given two numbers, eNB, so you can define a and B, find the greatest between the two. Okay? That's what you can do now. So you can either pause the video or you can do it after this episode also. So let's see. What I mean by that is given two numbers means a equals 12, b equals to three. And then using if else condition, you have to try to find which one is brandished. So you can just say, if a is greater than b, print a, else print B, right? Because if it's not greater than b, then that means b is greater than the rate in such cases. Now, what happens if I need not 12 numbers, but three numbers, Let's say, okay, you can try with two numbers, but how about three numbers? In this case, we have to check for a, B, and C. So B and C. So this means we need to check for a for both B and C, right? So this is where we would use logical operators, right? This is where we would use logical operators. For example, I have a equals ten, b equals 12, c equals three. Now what I have to do is I have to check if a is greater than b and a is greater than C because it has to be greater than both a, B, and C, right? For it to be the greatest between the three. So that's why what I can do is I can see if e is greater than b, just the same narrative that we used. And it's a B. And because it has to be both rate should be also greater than c. So in that case, you can see E is the greatest. Alright? And LF, now in this case we need LH because we have to check for b also, BNC also. So if again, same thing should be greater than which to a and C for it to be the greatest. So v is greater than e and b is greater than c. So in that case, because it is greater than both, That's why B is the greatest. And similarly now I could use a leaf. But then if E is not the greatest, B is not the greatest, that means we don't have any other option. C should be the greatest, so that's why else print C is the greatest. So here what we're trying to do is we're trying to use logical operators with conditions, right? So condition returns either true and true. This means that E is greatest, right? Because both are correct. So as you can see, in our logical operators, we worked with true and true, true or false, like that. But here we are replacing this with comparison operators and we're trying to compare between two values as well as that thing. So in this case, you can break down this to our truth table. So let's try to break this down. So a is greater than b, ten is greater than 12 null, that means this will be false, right? E is greater than C. Yeah, that is, so that means true, false, and true. We'll go back to the truth table. That will always be false. Alright? So that would always be false. That means this would not be executed. Now it will go to the next one and it will check, okay, is greater than E, b is greater than a, 12 is greater than e, right? So that means it will be true. And B is greater than c, we are 12 is greater than three. So that means it will be true. So true and true always returns us group, right? So that's why it'll print b is the greatest. So this is how you can break things down into pieces and try to understand this in that way. So this is how we use comparison operators with the logical operators with if else, if else condition. I know this lesson was a bit intensive and you might need to go for backward, go forward, try to see yourself a little bit. And again, practice is the key. So you want to practice this. You must try this on your own. And you must try to understand this from the logical point of view, not just trying to understand the syntax, copying it. You have to understand what's going on. You have to try to break down things and try to understand that way. Alright? Alright. So I think we can understand it like that. That is how we use if elif and else conditions. Now in the further episodes, we'll be talking more about if elif else, because we might need it in the advanced topics also. But again, for you to go into those advanced topic, you have to understand it and understand it very principally, technically. So that's why practice, you must practice a lot. And in the next episode, I think we'll be talking about the loops and we'll be going on forward like that. So I'll see you in the next one. Keep practicing and happy coding. 24. For Loop: The if else, conditions and conditional statements. Now, if you remember, we talked about something called control flow or control structure. Right? Now, in control structure, there are two things. One is conditional statements and second is loops. Now that's what we will be looking at today. The loops. So I'll just remove everything here, right in your comment. So we'll be looking at loops. The concept of loops, there are very important because this will be helpful in upcoming programs that you make. Because the concept of looping is quite useful in terms of programming. So whenever you are going through the series of looping, I think we'll have total three lessons on looping. I think it would be great if you can make some notes on the way because it will be really helpful. Alright? So what we'll be looking at is what are loops first and what are they used for and what their origin is. And then we'll, we're looking at the types of the loops. And then we'll be covering the first type of loop in this video and then second type of loop in another video. What is loop? By definition, loop means literally, loop means to go in a cycle, right? In a vicious cycle, let's say there is 1234567. Then it keeps going on and on and on. The cycle keeps going on and on and on. That's what loop means to keep iterating. The main word here, I would want you to note down is each reading or iteration. It's really helpful word iteration. Now, what is iteration and what is iterating and what do they actually mean each rate means to occur, right? Meaning, so for example, if I wanted to print bison, if I wanted to print it ten times, then what I can do is I can loop it ten times. That I don't have to keep printing it like this, like this. Like this. I could do this, but then this is a bit inefficient because it does not follow a principle. There is a principle in programming called DRY. It is a salt form for do not repeat yourself. So in programming you should not repeat yourself, right? So that is why I think we are basically repeating copy and pasting here, right? We are repeating and there is a better way to do this. And when we repeat, what happens is it increases the lines of the code, which will in turn increase the time complexity, meaning like how much runtime does this program tick? And the runtime will automatically dictate the memory that this program consumes. Now in Salt programs like this, nothing drastically will be seen, right? But in programs which have millions of data conversions going on, in those things, it will be really drastically. So that's why we use the concept of loop was introduced. And that's why the concept of iteration was introduced. The basic idea here being that we want to make sure that we are repeating through the code again and again and again and again how many times we need. And that's the basic concept of loop. Now in Python, now, it really depends upon the programming language, because depending upon the programming language, the loop can differ, right? Like the types of loop can differ. But in Python programming, we have two types of loops. You can write it down. So two types of loops are. One is FOR loop and second is wild loop. Sometimes people confuse while loop with something called do-while loop. Do-while loop is not in Python, but it's in other programming language like C, Q Basic, Basic. In those things we have do-while loop. But in Python we don't have do-while loop. So that's why it just for loop and while loop to measure loops, right? In this episode we'll be looking at the for-loop specifically and how to write it and some of the examples we'll see and we'll be understanding it that way. Okay, so now let's go into the for loop. Now what does for-loop actually do? For-loop actually goes through an element. So if you want to write it down, It's better if you do. For loop goes through an element, means an element or value means it scans through it. For example, let's say I have a string called Python, okay? Or let's say, let's just see 12345. That's a string, right? What for-loop will do is it'll keep going from firstly go to one, then to two, then to three, then to four, then 25, right? That's how it will iterate. It will scan through the animated. We'll go through that element. And the syntax of for loop is, and also like for loop only works with two kinds of values. One is string and another is Eddie. It does not work with anything else. So for example, it can be a list, it can be a tuple, it can be set, it can be a dictionary, it can be anything. But if it is an array, then for loop works. So for loop only works. Let's write it down. Only works with string Henrys. Okay? Now let's look at the syntax of a for loop. For loop basically starts with four. Okay? It's a, starts with four and we can give a index variable. Index variable. This is a variable that you can name anything. You can name it index variable, you can name it a, it can be, it can emit Python, you can name it whatever you want. Standard. By standard we could use for AI because usually people use that. So that's not actually like necessarily, but that's just a known, right? Like people say for I in, I stands for index. But you can name it anything. You can also see a, you can also see B, this is a basic variable. Okay? So for variable, Let's see, I'll just say for var. What we will say is so far var in, or let's just say for character, that will make more sense. For character in our string, our string, our string, we have to define where do not have any string. So we'll say string equals what, 2345. Okay, so what character will be now if I print the character is 12345 individually. You can see first in the first round of for loop, it's one. In the second round of for loop, it's two. In the third round of for loop, it's 34 thrown for a loop is full and fifth run a for-loop is five. So this means character is a temporary variable of each single element or character in a string. So you can understand it that way. Now it can be also with areas. So let's just change the variable value to an area of hello. Okay? So in this case, now, it will be now each element of, every, every element, right? So something like that. Hello, my name is biting. So this means now what you have to notice here is how many times the for loop is being occurred. That's very important. Meaning, how many times has it occurred? One time, two time three times, four times, five times. Five times. And what's the length of this array? It is 12345. So this means what do we have to understand is the rounds of the for loop is directly related to the length of the value, meaning the string or array that whatever you give, right? So for example, in the string example before, if I would have say 123, then it will just run three times 123. So the loops are the rounds or three. How we can see this is if I don't print character but something else, Let's say I want to print hello right there. It'll print, print hello three times. This means the rounds of the for-loop is directly proportional to the length of the value that we're given. If I increase the value, length of that value, there, it will change. If I increase the length of that value, then the round of the for-loop will also change. So this means that rounds of the for loop is directly proportional to the values or the length of the value that you give. Alright? So now let's say I want to print Hello World for ten times or Python for attendance. How can I do that? Firstly, I have to be able to create a for-loop with ten rounds, right? So this means I have to create a for-loop with ten length of the string or edit. So let's just create that. So I'll just say string equals 12345678910. All right, that is ten. And what I can do is I can just say for now I can give any name. So I'll just say iPhone is easiness. So for I in string, now I created a for-loop with ten rounds of for loops, right? Rotate your reputation. Now I can just simply print Python, right? Then it will help me to print python for ten times. Can you see here 12345678910, right? Because this is ten times the for loop has ten rooms. And in all the ten rounds we are printing Python. So that's why it'll print button. Now it's not mandatory to put it like this. I can directly put the value just here like this also. That is also possible. Anyways, the values would be there, right? This is all to the same thing actually. Now can you see the difference in printing Python for ten times by hand versus something like this versus this, what is sought to and what is easier. This is, is you're obviously rather than printing, copying, pasting, copying, pasting, it'll if I have to print it a 100 times, then I have to do it like this. And it is so messy, I can't see what am I doing, right? So in this case, in such cases we need FOR loops and loops, actually overall loops. And it is very helpful if you use loops in most of the cases as much as possible. You should always abide by the principles. Do not repeat yourself. You need not repeat yourself as much as possible. Obviously, if it's not possible, then obviously have to repeat, but as much as you can, you must avoid repeating yourself. If you find yourself repeating, think about it and think about in terms if you can replace it with some kind of loop or with some kind of some things. So you have to remember that if you are repeating, try to find a way out right. Now. Now that I have done this, right? What if I want to print a 100 times? Let's, I want to print python for a 100 times. How can I do this? I don't. If I start writing like this, then it will take eternity for me to write this. Or how about thousand times? In such cases, Python provides us with a native function that we could use. Meaning, I'll just open it in here. Console. Okay? Something like that. Okay? So for example, in Python we have something called rains. And rains takes three arguments. One is start, second is 30 step. And if I put in, let's say a start value of 0 and a stop value of ten, and strip value of one. Let's see. Then I will get a range of 0 comma ten, right? This means if I create a list of that, I just want to say is that you can see I will be able to create a list of length ten and up to the number ten. So we'll talk about that. Why is it up to nine? But that's the whole principle. We could use range to create such area with 100 liters. If I want to print it a 100 times, then I would have to start with 0. And always, again, what I said just now was start, stop and step. By default, step is one. So if you don't put any step, then by default it is one. By default start is 0, okay? If you don't put a start, it will understand it as 0. So it will always start from 0 and stop. We have to provide. So if I say ten, then it will give me. If I now print i, then I can clearly see that. You can see it starts from 0. So the range starts from 0 and ends at nine. So this means stop is always one mole, meaning it'll stop at ten, but not including ten. So if I want to print up to ten, then I would have to say 11, right? Because I want to stop at 11, but we want to, so ten. That's how, let's say I wanted to put up two from one to ten. Then I would have to change the start 211 comma 11. Then I will get one to ten. And let's say I want to jump each. I just wanted to maybe print just odd numbers. Then I can say step by default is one, but I can change it to two. Then it will say 1359579, write something like this. So this is how it works, how the Green's function works. Now, if I wanted a 100 times, then I can just say simply a 100 that will create from 0 to 99, which is a 100 things. And if I can just print python, right? If I just do that, then I will print python 100 times. If I want it ten times, then I can just say for I in range ten, print Python, that will print the tendons. So that is how you actually work with for loops and range. Now, obviously you can also change this with, for example, if I wanted to see all the characters in a string. So let's say I'm given a string and I want to print all the characters of that string, then something like Python. Then if I say for I in string and print, print die, then I would get something like t by t o n. So it will go through that element. Alright, so that is how we do it. Now, how we use these things depends upon us. What I want you to do is before we jump into other things, I want you to do this problem. You can pause the video or the video and try this problem on your own. Print from 99 to one in backward. Now again, pause this video and try this. Once we diagnose veins thing that we just did, you can just pause it. I will give you some moment. If not, then you can come back. Alright, I hope you tried it at least. And that's a great thing that you tried it. Alright? We know that about the range function. We know that how ranges start, stop and step bright. Meaning if there is one stock value that I want to give, I want to print from 99, so my start value would be 99. And I want to stop at one, means I want to stop at 0 because I want to include one, right? And by default, step is one. So this means what it'll do is it'll say, Okay, Ninety-nine plus one. But that's greater than 0. So that means I don't have to put anything, so this will just give us nothing. That's why what I want to do is I want, for every round, I want to decrease it by one. So 99 to minus one, right? 98. So that's why rinse it be minus one. Now, once you have this idea, now you can try it. Now you'll be able to do this. Because if you just say for I in this and then print i, then you will get it right. Now. For example. For example, if you needed some kind of airways, We can try with a is also, but this is what you can do first. You can pause the video and try this on your own once. Alright? And so what you can try to do is once you are done with this, you can pause the video and do this. Once you are done with this, what you can try now is to let say I have a, given a string. We are also trying to practice here. So given a string, print, whether a print, whether a straight character is, let's say, print, how many characters, how many A's are there. Without using dot count, obviously, we can use dot count also. But how many character? So I just wanted to see for not volume, but just a, so in that case, you can pause the video and try this again. Otherwise, we didn't do it. Okay. I hope you tried it anyways, if you can. It's great. If not also fine. So we said that we are given a string. So I can just say string equals some kind of strings. So I can just say, Okay, now, what I have to do is I have to go through that element and check for every character. And I have to see if that is a naught, right? So that's why what I will do is I will say for I in string. So if I print I, you can see I is, I'll just comment this. You can see AI is all the characters right? Now, what I can do with AI is I can say, okay, if I is equal to a, then that means we can say a fault and great. Okay, Let's see. A phone. So one was found, right? But in aeroplane we had to write. But what happened was, one of them was in capital, right? So that's why what we will do is we will change everything to lower. So I, whether it's capital or not, if you remember, we used, in string methods, we use dot lower to lowercase that. So whether it's uppercase or lowercase, it changed into lower and checked with the lower right. And even if is capital, then it will be firstly changed into lower than checked with the lower eight. And then it will say is found. So now there are two A's found, a, found a font to our font. Now, increase the count of a three times. Then you can see a phone, something like this. So this is how you integrate control structures. So you integrate the for-loop with if condition conditional statements. So you have to really try to play around with the code for you to understand and get a good grasp of vector a. So the next thing you can try when, before joining into the next episode, you can try, given a string, print how many vowel letters? So you don't have to just find for a. But now with AEIOU, you might need to use conditional operators are logical operators like R or whatever. You have to try it. And you can try that. How many letters are there? So you can try that. And once you are done, then we can move into the next one. The next chapter will be on our second for loop, sorry, second type of loop, which is y loop. And we'll be covering that for a moment. And then after that we'll be going into other details of it. So I think you can try this and you will get a good grasp of using control structures in integrated form. I'll see you in the next one. 25. While Loop: We looked at the for-loop and how for-loop actually works. Now, if you remember what we talked about in the loops, basically just covering the revising the whole thing. Loops are those which are iterating again and again, right? So if it is repeating for itself, then it means it's a loop, right? So that's why we also said iteration in aqueous iterating. And we also said why this is crucial, because it's, it follows a principle in programming called Dry. Do not repeat yourself, right? And we also talked about the two types of loops, and those are the four loop and while loop, right? And we said that for loop goes through an element, right? And values to scan it. And we looked into how for-loop works, and we also see, saw some examples of integrating for loop with Conditionals. Alright? Now that being said, we have another loop which is y loop, and that's what this video is all about. So we'll be looking at the concept of while loop, the structure of while loop, the metal methodology of how we can implement while loop. And we'll be looking at some exercises that we can do with well, all right, so that being said, let's get started. So I'll just make sure that these are cleared out. Okay. I will just basically coming these things so that we can break them down there. Okay? So while loop, just like for-loop works on a principle of Queen Through an element or value. To scan it. It only works with string in areas. While loop works only with, only works with Boolean values. William values. Okay? And it has it working in such a case that it works as a trigger. So if it is while true, they need in definitly runs and when it becomes wild false, then it stops. Just to show you a quick example, how loops are written is like this. So we say while and then true or false. So I'll just say crew, and then I will just say print running indefinitely, run in such case it will indefinitely, it won't stop. It will stop it. I have to delicately stop this thing. Disliked that. I'm sorry, like that. Then I have to stop it with keyboard interrupt. Now, that's for true. If I say false, then it will not run, right. So the basic principle of why is that if it is true, if that statement is true, then it will run. If it becomes false, then it'll stop. Okay? That's how we keep iterating. So that's why, if you remember, we talked about conditional operators, right? Conditional operators and we also said comparison operators. And in comparison operators does give us true false value, right? Boolean value. So for example, like five is greater than ten, that gave us a Boolean value of false. And seven is less than ten, that give us a boolean value of true or something like that. We can actually replace this with something dynamic. So for example, I can have a counter value. So for example, let us take an example of what we did with for-loop and we can replicate that into y loop. Let's just say that we want to print from, okay, I want to print biting for ten times. Let's see. So what I have to do is firstly create. Again, like whenever you are trying to write loops and whenever you're trying to write iterations, you have to firstly create the rounds of it. You have to create first rounds and then you can execute your code on, right? That's why we have to create grounds. Now for it to create a round. If it is true, then it keeps running. Then when it has to be stopped is when it reaches the point where it is ten, right? So we have to keep counting how many times the loop has been executing. That's why we'll keep a counter variable. So we'll start the counter variable like this, count equals 0. And every time the while loop occurs, we will say count equals count plus one. So what we're doing here is basically trying to understand. So for count will be initiated at 0, so basically count to 0, right? Then the first round of while loop occurs. It prints running and then says, Okay, count is cool to the old count, which is 0 plus one. Now the new count becomes one, because 0 plus one is one. Now another round comes in the second round, count equals count plus one. Now currently count is one. That means one plus one is now the new count becomes two. And similarly again, the old count is now two plus 13 and then count becomes three. And then it keeps on going Tilton. And then once it's done, we have to stop it. So we have to create a dynamic value to stop it, because we will always keep running. So we need. To compare this with count. So if while count is less than ten, right? Because right now count is 0, which is less than ten. Okay? And when it reaches ten, it is less than ten. No, it is not less than ten. So that means it'll reason false. And that will just stop it. And that will become false. So while false becomes stop. So that's why I'll just print fighting now. I created the ten rounds of loop. Then I can just say print Python. Now we can see it's printed 12345678910. Just like that. Obviously the concept of while loop is a bit. Maybe it can be sometimes complicated to understand, but just understanding how it works, it works on Boolean values. And it only works with dynamic values like you can just see this. And we want to compare this rate and it keeps changing. So current keeps changing. And once it reaches ten, then it stops because then it turns it into fault. That's how we dynamically change it. Now similarly, we can have all these things done in what we did in for loop. We can also do in our while loop. Okay, let's just go through it. Now. Print from 99 to one in backward. Okay? Now in this case, I might not be able to reduce the range function, but I will be able to use something different. Okay? So print from 99 to one in backward. So 9999 to seven like that. So I have to now create, what is I have to create an initial value, which is like, just like how we did with the orange stock value. So I will just say start because we want to start from there. Start equals 99. Know, if that stock now start sued not ready to stop is when the star becomes, that value becomes one rate, we have to stop it there. So that's why while. So when we have to stop it is, well, start is greater than or equal to one. So we have to say, Okay, if that is greater than 99 is greater than one rate. So it will start the while loop, and when it reaches one, then it will stop the while loop, right? I mean, after one when it reaches 0 because we also put equals. Now what we have to do is we have to decrease, start by one. Because every time the while loop occurs, then we have to decrease it. But before that we have to print that start. So instead of saying start, I'll just call it Val. So it's not just one single thing. I'll just say value for value. Okay? So we have Val and now we've printed value. Now. I just keep it like that then it'll just keep saying print. Like printing the ninety-nine. Ninety-nine. Ninety-nine, just like that. So for me to in order to for me to make it dynamic, I have to change the value of it every time the while loop occurs. And that's by going in backward, stepping, right? Minus one. So that's why what I can do is Val equals Val minus one. So every time the new value is equal to the old value minus one, which is 99, minus one is 98, now becomes 989. N minus one is 97. So new, well becomes 97, just like that. I can create from 99 to 101. Just like that. In backward. A way to replace this is that there is a better way to say it because count equals count plus one is 22 vast. I mean, it's too long. So we can see the same thing by saying count plus equals one also, it's just the same thing. Count plus equals months means the old count should be increased by one. And also we can do this with the same width minus also, we can say minus equals. The old valves would be decreased by one every time. I subtracted by one every time. So that's how it works. And we can move on to the next Example of our thing. So we have, let's say given a string, print, how many characters are there? Eight characters, E are there. Okay, We can do that. Alright. Okay, so given a string, so we have to have a string. So that's why we can just see a role-playing. Now, since we have to go through this string, we have to get every element of the string. What we have to use is we have to use something called string indexing. Indexing, I think we learned this before also. But just to make you remember this. Index values are the values of our strings. So 0 index will be a, one index will be e, to index will be r, and such things. So it starts from 0 and keeps going on. Now, we can use that indexing values. Now, we want to keep going. How much do we want to keep the, to keep going with this is depends upon how many strings, sorry, how many length of the string is, right? What is the length of this? So we can say length equals. There is a native function in Python, we can just say len and then the value that we want to see, the length. If we just do that, then print that name. You can see I will have, sorry. I'll have the length, like airplane has nine. Okay? Now, now that we have our length, so we can say, okay, we can have to go till that length rate so we can start a counter variable, count equals 0, just like how we did that here. And then we can say, while count is less than or equal to length, because it should always be less than or equal to length. Once it gets bigger than length, then we have to stop it because then it is more than string. So that's why we can just see we want to start from 0 and n till our length is there. I think equals two is not necessary because it should be less than that length right? Now, if I print hour. Now, obviously we have to dynamically change count because count is what is being done here. So I can see a count plus equals one. I will increase every time the while loop is. And then once it finds the length is done, it will just do it. I'll just print that count just to see how it dynamically changes its value. Okay, I'll just comment that. Then run it. So you can see it start from 0 to eight. And that's exactly what we need. Because the index value of 012345678, that's what exactly what we want. Now we can use that index value. These are the index values and we can see two to get the index. So for example, if I have a string, that if I say string 0, then I will get e. If I say string one, then I will get E. String two will get me. Our string three will get me. All right, Something like that. So similarly, those 123 are counts. So that's why we will just say string of the account. If I bring that up just to see how it looks like, you can see, I'll get all the, just like how we did in the for loop. Obviously it's a bit complicated here in while loop. But just try to understand how it works logically, right? Once we have that, now we can simply this is our letter. So we know that this is our later that we are printing. So if that later, So if that letter and then we have to change it to dot lower because we want to check it for lowercase. All right, so dot lower is equal to e, then that means we have to say, okay, if I run it, you can see there are two 0s and then those are found. If I change it to more than, it'll say. Something like that. Obviously this is a bit complicated. Maybe to some people may find it complicated, some people might not feel it complicated. But overall, this is a good logic. And you have to understand it in a point of view from a different aspect because we are using multiple things here we are using Boolean values, here we are using counter variables. There are lots of things going on. We using if conditional inside while loop. We are using also string methods, right? All of the things that we learnt till now and now getting into the place. That's why it's very important for you to try to understand what's going on really, if it is not clear for you, I would encourage you to watch this video again and try to understand what's actually what it is that is going on in this video and then just try to get a good hands-on it, right? And what you can now try is the next thing that you can try is something like this. How many? So now that you have understood how to count, something like that, so we can just add a leaf, right? So you can try doing this. So how many letters are there? So we checked for a, similarly, we have to check for, we have to put LF and then check for E. Or we can also put r and n. We can use conditional operators, logical operators. And then we can do that. And we can say for AEIOU, right? Something like that. So you can try this, you can, if that logical operator does not work, you might need to have else-if I'm sure that you have to use elif because we have to say a phone iPhone if found oh, fondue far right. Something like that. So yeah, I think that would cover the while loop. The basic concept, again, just to revise everything. While loop works on the principle of Boolean values and comparison operators. It can also have logical operators as well. Because at, at last, the logical operators also give us a Boolean values, right? Because the at-large to operate between Boolean values, then That's the main thing and it has to be counter. Counter value should be always increased so that, that is compared, compared here. So that's why dynamic, dynamicity is very important in while loop. So I think it's more on you to practice a little bit with this example question that I gave. And once we're done with this, then you can jump into the next chapter. The next chapter will be on break and continue. So we will be looking at how to break some control structure and how to continue into a control structure. So that's what we'll be looking at. Happy coding and I'll see you in the next one. 26. Break and Continue: When we talk about control structure, I think you got to know what controls structure is from our last episodes. Controlled structures are those values, are those things which control the flow of the program. And in control structure we have conditional statements. This whole section here is about control structure and conditional statements and loops, those things. And it's important for us to have a good manipulation of those loops. So for example, in some cases we might need to break some loop in just middle, right? If some situation matches, We might have to say, okay, that's it. We have to break. In some situations, we might need to continue the whole thing, skipping the things, right? So in those cases, we use something called break and continue. Now what is break? What is continue? We'll look into those things just in detail now. Okay. I will just remove the things from our old episodes. Okay. So we have break and we have continued to tax. So let's understand what those are first before jumping into conclusions. So break is, the functionality of brick is to break the whole loop. I'm not saying while loop here. Just the whole loop, right? Like the whole loop. Not just the part of the loop, but the whole, OK. And continue. We'll skip the loop. If the loop. Okay. I think you can just let it digest a little bit into your brain. Break will break the whole loop. It's continue. We'll just skip the current round of loop, okay, We'll look at it in a good examples, but just to understand and make it understand it for you. Okay? We'll have applications in two things. One is for infinite loop and is in one case in both situations. Okay, let's say in the for loop. So where do we might need brick? Let's understand that. So let's say I have a problem seed given string. Try to see if the string contains any number. Okay? So we will be doing this with a for loop. Okay? So what it is saying is that we are given a string. So let's just write it firstly. Given string. So I'm given a string EBC and try to see if the string contains any number. So let's say I just added that. So if there is a number, then we have to say, oh, number font, right? And just one number will work for it. We don't have to find how many numbers are there. If there is normal, we have to print okay, number four, right? So in such cases we might need brick house. So I have to check for if I have a number or not for that, I have to say for I in string because I have to check for every element of that string, right? Every letter. And you know, if I print the string, sorry, I, then I will get all the strings right? Now I want to check if I, if you remember, there is something called dot is what was it is numeric. If you remember our string methods. And if that AI is numeric, then that means what? Our number phone. If that's not the case, if that's not numeric, for example, in this case, we were just do nothing actually, we'll just keep continuing. So in such cases we can use continue. Okay. If I run this, then you will say it will say number, phone number, phone number, phone, but we just needed one number formed and that's it. Why is it giving us number phone number four? Number four is because firstly, it's found okay, It's going through E. Okay, continue. That's not non-numeric. Be, okay, That's non-numeric. Continue, see also not. And one is numeric, okay, then means I have to print number found. Then here the for-loops or break. It should not move forward because we have already found it. But what it is doing is it's going into the next round, okay, too. Okay. Number four, next round three, number four, and that's it. So that's why if I want just one thing, then I would have to say break. Okay? That's one case. And if I run this, then you can see once the number is formed, okay, number is four. So no question marks. Number is one means number is four. Similarly, this is the case where we use both break and continue. But if in this case continuous, not actually necessarily. If I just say nothing, if I don't have any else thing here, then also it will work because anyways, the for loop is going to continue until it's number, right? So that's why it will continue like that. So that is for our for-loop in break. Now, let's see the actual implication, implication of continuum. Let's say, I want to say given a string, tried to see if the string, what we can say is if the string, we can say that does not have to be a number. In such cases, what I can do is I have given a string, so string equals 12345. Ability for AI in string just the same thing. And try to see if the string does not have an alphabet. Means I want to see, okay, if I dot is numeric, then I wanted to continue. And if that's not numeric else, then I want to see alphabet font, something like that. It just the opposite of this when we had to find a new alphabet number than we predicted. Because once the number is found, but then if it is checking for alphabet, then we have to say, okay, numbers to continue, but alphabet should break. The break, we'll come. So I'll just show you, so alphabet found. So one alphabet font. If I have three album alphabets, then it'll say alphabet found. Then I would have to say one stack alphabet is found, then I have to break it, right? Because then I have to stop the whole flow. In such cases, the continue and break can be useful. So the basic idea of continue and break is to hinder or manipulate the control structure and control flow continue, we'll skip this process. So if it is found numeric, then it'll skip this round. So it won't go to else it will directly go to the next round and break. We'll just stop the whole thing. Whatever is remaining will remain. It'll just get out of that loop ray. That's the whole idea. Now let's look at the implication in while loop as well, and then we can move on to the next chapter. While loop. While loop logistic, the same example given a string. Basically same thing just for us to make understand given a string. So let's say I have this stream string ABC123, and I want to check for if it contains any number or not. So what I have to do now is, again similarly, just like the last time we have to use Len equals ln of that string. And also we need a counter variable to make it count. While our count is less than length, then we would have to say count plus equals one. Just the same thing that we used in the while loop. So if it's not clear what I'm doing here, you might need to go back into our loop and understand how a while loop works. And we're trying to now use indexing here. So if strings count, because count is the index value, count is how what we used was, is numeric rate. So if it is numeric, then that means number 400. Print number four. And then otherwise it keeps going on. Now if I run this, you'll see it will again say number found. And if I use break here, in this case, then it'll say just one number for just the same thing that we used. Just while loop and for loop are different. But the way of using it, like I was the character and string count is the character. Don't eat number numeric. We are using if conditionals and we're printing and breaking it. Same thing. Okay, Let's go to another one, which is for the continue in value. Then we can move on to the next one. Again, if this is not clear enough, then I would want you to watch while loop again, while loops video. Okay? So now similarly I will have to have the same things, linked account and things like this. I will just make it 1234. Something like that. It sounds good. And now what I can do is I can start our while loop by saying while count is less than length. And if our string count, our character is numeric, then I want to do What is I want to continue? Otherwise, I want to save print alphabet found. Same thing, similar concept, and then I want to break it. And if I run this, Let me see if there's any error you want to continue. Continue, and then printed platelet count. Okay? Yeah, there is one mistake that we didn't increase the current because current is always 0, so it won't keep moving. So that's why I just say count plus equals one. Then that should work. Let's put this count beforehand. Because a break we'll just stop it right. And it wouldn't have any other chance to go forward. So it'll say, okay, alphabet found and that's it, done, right? And if I didn't have this break, then it will say Alphabet Fun for three times three. In this case, if I have brick, then it won't say anything and just say Alphabet phone and that's it. This is how you implement break and continue, and that's how you use it. Again, break and continue are used for manipulation of our control structure or each region or loops. And a break and continue only works in a loop, so it does not work in anything else. Yeah, that's it. I think you can try this again with the same questions that I gave you. You can try it just a little bit. You can keep practicing. And I'll see you in the next one. Next one will be on exception handling, will be looking at how we can handle different kinds of exceptions that we might get in our program. All right, then I'll see you in the next one. Happy coding. 27. Exception Handling: Exception handling. So what is exception handling and how we actually handle our exception and what are exceptions. We'll look into all those details. But before we jump into our exception handling, I will want you to be very much proficient with other things that I have Torque you over the time period. Be it the control structures, the for loops, while loops, if else conditions, the operators, the string methods, List Methods, everything I want you to cover and be perfect at everything that we have learned yet. From here on, this will be the last one for this section. And from our next section we'll be looking into function's argument will be going more deeper into advanced level programming. Now you are slowly moving towards advanced level programming. So next will be function. Then we'll come object-oriented programming, which is even more detailed, that requires more intense studied. But anyways, what we'll be talking about here in this video specifically is exceptions. Now what are exceptions? Let's firstly understand why do we need exception. So let's say I have a program which has, let's say string or a dictionary, right? I'll just say dictionary equals. I have a dictionary called apple, fruit. Banana, yellow food. Similarly, I have orange. Something like this. And let's say I have to print. I don't know what is in the dictionary, but I want to know the, you know, the meaning of banana. Banana, I knew because I haven't read. But what if I put something that is not there? Something like grapes which is not there, right? It'll give us something key editor, right? In such cases, maybe we want to say, Oh, that's not in, we want to apply our own EDR or our own thing, right? But how to do this? Because if it has, it does not have grapes. And if one way would be to use conditional statements and say, if we are looking for grapes, then you have to print this. But then what about if a person says something like avocado? In such cases? Also, we have to do the same thing, right? You can see something in common in all of these, whatever I put here. It'll give us a key error. It will give us something or key error. This is an error that we can use to identify. And we can say, okay, if there isn't a key error, then we create an exception and handle it. We say, okay, if there isn't a key error, then you don't do that. You do something else, right? You print something else. So that's the whole idea of things. So in such cases, we have to use exception handling because we are trying to say, okay, except for key error. We want to do this right? Except for key errors than do, do this. So for this, we have a structure in syntax in Python. It is called try and except, try except. And how do we write to try and except it's just like how we write, it fails condition. However, we don't have conditions here. Try this. And if, if that does not work, except this way, this is how it works. Except we can see the error as the rate and that's the structure of it. Now we can say try dictionary. We had grips, dictionary groups. Then if I want to print it, because I want to print a grid, try printing the grapes from dictionary. But if that does not work, if it is not there, then we want to accept for handle for whichever key error. So we want to see the spelling should be correct. The capitalizes in autism be correct. It's called, this kind of capitalist isn't, is called camel capitalizes. And because it has bumps here, right? Just like camera has bumps in there. Back. It also has bumps, right? So that's why it's called camel capital isn't just for information. We can give it as an exception as any, any variable that we want to give. We can just say E also. Why we give e. If I print that E, then you can see the error itself. I can see the same error. Sorry, I don't wanna do this. And if I run this, it'll say E. E means the grapes because the grapes is not there. Now, let's say, I have to say, oh, that's not registered in our dictionary. Right? And then it'll say, Oh, that's not restricting our dictionary. However, if there is something which is there, then it'll just print that a red fruit, great. In such cases, in some simpler examples, we might need exception handling. So just like this, right? Because it will be helpful for you to change the header into something meaningful, right? That's the main advantage of exception handling. Because previously when we did just print dictionary, just for this example. When we just did this, then you can see the grips. You could see we were given an error rate error message which is native in Python to edit this error message we used except we tried this and it didn't work. Then we accepted a key error as e. And then we printed our own message out there. And it works just like that. And it just that you manipulate. Now that's just one example. There can be multiple examples. For example, we looked into our data that convergence also. We tried to convert data, right? And we tried to, there is some things like okay, let me just do that. Okay? So let's say I have a string. Let's say I have NO okay? Number. So I have a number called 1234, and I have a string called 1234. And let's say I want to add these two. Print num plus string. Now it'll give us an error because these are two different types. Datatype, one is integer, one is a string. In such cases, we can see, okay, try that. Try doing that. But if that does not work, if that does not work, the next step, which error? This is now not key error, but now type error as e. Then we can see our own later that, sorry, desert and string cannot be added together. Together. These used datatype conversion chains, either of them, something like this. So if I run this, then you can say it, it had changed the error message to sorry, the integer. And it is much easier to do it, right? In some cases we might need it. And if it actually works just like that, then it won't be executed, it will just add it. But if there isn't a type error, then only it will start error, right? So something like this is very helpful in terms of when we are trying to handle different kinds of exception. Exception means editors rate. So we're trying to manage different errors. And also if I bring the e here, the variable here, this variable, you'll be able to see, we'll just get that error message, which we got when we just said that. So you print num plus string that this, this part is taken as an error e, that part just the message part is taken as E. So we can see something like this also. Slip. Got an error saying and then we can just saw this so that our native thing does not so, right. And we can just this. And just to show you, and that's how it looks like. We got an error saying, and then we print out that app, right? So something like this. So this is how you work with exception handling. We tried to try this and if that does not work and do that, so something like that. So this is how you handle exceptions and handle errors. The next unit would be on functions and functional programming. We're looking at functions, arguments, return and recurs in parts. So that is going to be fun up to here. If you're not have any confusion, I would strongly suggest you to watch videos again and again and again so that you get a better understanding of it. Otherwise, we can jump into the next chapter and we can see what we can learn in the next one. Next lesson would be on functions. And we'll be looking at how we can create function. What are the implications in Python and stuff like that. So, yeah, that's it for me today. And for this episode, I'll see you in the next one. 28. Function: This episode we'll be looking at what are functions in more detail about functions in Python programming. Before we jump into functions, we must understand that there are multiple kinds of programming, and some of them are. One is structural programming. So a structured programming is normal programming that we just used to do. Like, you know, you put variables who printed in structure, that structure programming with controlled structures and things like that. Now, second type of programming is functional programming. And functional programming uses functions. Functions, and that's what we'll be looking at. There are other types of programming such as object oriented programming, which works with objects, which we'll be looking at in a bit also known as sometimes object-oriented programming. So these are some of the basic types of programming that you might encounter. And today, in this episode, we'll be looking at functional programming and specifically functions. So what are, what is actually the concept of functional programming? Now if we go by definition, the functional programming is, functional programming means functional programming means the programming done using functions. That's basically the definition of functional programming. Now, what are functions? That's what we have to look at. Now, functions actually come from mathematical point of view. In mathematics, if you have some detail node is about mathematics in your history or your row, learning mathematics, then you know that in mathematics we have functions and usually functions are defined as f x or f n, right? Something like that in mathematics. And that's how functions actually come in Python also in programming. Also. Functions are those kind of, you can call it as a machine, which takes an input and gives us output. So you can call a function as machine, a machine that takes an input and gives us out good. That's how you can tentatively understand what function can really look like. And just to have a better understanding of what functions really are. Now, what kind of machine are the, these are the machines that do some action. So those machine have a action. So that's the important part. Action is very important in function, so they have some kinds of Creed game might actually have to predict your mind. You don't mind action. And the thing about function is it also takes input. That's what we talked about, and it gives us output, right? That's why function actually follows a principle called IPO. I think this we talked about in our initial episodes also, which stands for input. Processing. Output. And input is the input output. This output and processing is the action. Whenever we create algorithms and such things, we usually use functions. And that's how we actually do it. Now, for example, in mathematics, there is a function called Fx equals m x plus c straight line equation, where f x will be equal to m x plus c, right? This is like a straight line equation. Now, we can do the same thing in a way that Python understands. Also, write in Python how we create a function is by saying we're in function, there are two parts. There are two parts. One is two parts of function. One is definition, and second is calling it. So this means we have to firstly define the function, then we have to call that function. So that's why firstly, we have to define and say, Okay, this is what this function will do. And what we can write it as basically by saying DEF, it's a salt form for definition, we are defining a function so we can give a function name here. Function name. So you can put any name here. Actually, you can just name it anything. It just your identifier. You can identify whatever you want. Usually and how we name that identifies how we named the functions. Are there are multiple things. There are snake, snake method, method, method, which is something like function name or hello word, something like this with underscore. So that is snake method. Camel capitalisation is capita. Lizzie is something like this. So function name, hello, world. So always that every word, capital, initial word is capital and it does not have any space. Whatsoever. There is another way of writing functions also. Like it's your own way. Like you can choose whatever is good for you. And other way is we can also say something like function name. This is also quite published specifically on Java and JavaScript. And Hello, the initial word is always small and then the continuing words are always capital and stuff like that. And sometimes also people write it something like just like that. Also the function name. And helloworld, something like this without anything. So you can choose however you want. Now I'll just write it with a snake method. I will just say function, function name. You can name it anything, by the way. And then we have to put colon just like we do in for loop condition. And then whatever is inside the colon, in the inside that indentation will be now the part of the function, right? And that's where our algorithm will go and that's where our, everything will go actually, right? That's where our function will have its action. We will write its processing thing, right? That is about function. Now, for example, if I want to save print hello word, right? Let's say this function, we'll just print hello word and the function name, I'll just say print hello. Okay? Yeah, and know that we have defined it. If I just run it, nothing will happen because I have just defined a function and Python does not know what to do with that, Right? And that's why the second part of our function is calling. So we have to call that function by saying, okay, our function name is print hello. Hello. Then I can just call that. Then if I run it, that statement will be executed. Now if I change this to something like handles on, it'll print hello song or something like that, right? And I can print as many as I want. So this also follows the principle of DRY, DRY. So I can also printed like something like this, then it will be executed that many times, right? Something like that. So yeah, this is how you write a function and this is how you define a function and color function. So two parts of function. One is definition and one is calling, and this is how you define and call a function. Now, let's try to do some examples and let's try to do some exercise and understand it from that way. Alright, so I'll just comment Is everything. Okay? So let's say we have a, The problem that we have to create a Python function for f x equals m x plus c. So this is like a straight line equation formula. And f x is always equal to m x plus c. So this is like this will create a straight line. So for example, let's say then I would have to create an F, write our function name is. So that's why I will just say f. And then here like this. Now we will have to have MX plus c, right? So we have m equals something, equals something. Mnc are usually constants. C is the y-axis. Also. X always is increasing. And this we will be learning in the next episode also about the arguments. And we'll be looking into arguments in just a bit. But I will just put it like this. We can put it like this. These are called arguments, which we'll be talking about in the next one. So I can now say print m times x times m times x plus c. What this will do is it'll create a straight line equation. So m x plus c. If I give you f, Now, if I just run it, nothing will happen. But then if I say, okay, what is the thing? If x is one, then what is y? Y is true, right? So one comma two. If x is two, then y is three. However we do it. It will be in a form of, it'll keep increasing based on m x plus c, right? So that is how it works. And in the next episode we're looking more into the arguments and how arguments actually work, and what are their use case and how they are actually used. So that's what we'll be looking at in the next one. I think you have to practice a little bit with printing Hello world and creating m x plus c, Also, something like this. And then we'll be looking at the arguments in the next episode. So that's it for me. In this episode. I'll see you in the next one with arguments. 29. Arguments: We'll be looking at the x thing that we put here. And that's what we call as argument. Now, it's important for us to know what arguments are whenever we are trying to write a function, because it's very crucial when it comes to function programming arguments please. A great rule. So what is argument and how do we actually use it? Let's look at that in more detail. Okay, so if we go back to our functions and what we said as what is function? We said that function is a combination of three things. One is action, or we can say predetermined action and input and output are in salt form IPO, input processing output, right? So the part that we go inside, the part that goes inside here is, we already noted it's known as processing, right? It's the processing part. Now. Where is input? Now that's what input is. The arguments are the input parts. Processing is the code that code that goes into the function. And similarly inputs are the arguments. Now when arguments come in the place. Likewise, I think are parameters also come. Arguments and parameters. And parameters come side-by-side. So what are arguments for that parameter? Let's look at it. So for example, you can just understand if you put any variables. So arguments and parameters are the variables that goes inside the function. So it is If we need one argument or one input, then we just say x. If I need two inputs, then I can say y or any other variable that I can eat, right? And I can use it inside it. So what I'm doing here is I'm assuming that y is given and y is given as an input. And then I'm calculating with that. Why? Then we are giving the value to the y over here, like this. So x is given value, y is also given value now, like that, right? And it is also given value like that, right? If I don't give value, and if I just have this, just one, but we are expecting two arguments, then it will say, required to positional arguments. However, if I have just one argument and if I pass in two parameters here, then it'll say dx1 positional argument, but to break-even. So that's why it's important that both of these are equal, equal length. So if there are just two inputs that are asking, we are asking then we can use this two inputs. If we are using three inputs, then we have to give three inputs here, right? Like that, then it would work. Now what I can also do is I can now see the arguments and parameters. What goes in the definition of that function. What we put in as x, y, z. Here in the definition of that function, these are known as arguments. Okay? These are known as arguments because these are not actual values, but we are assuming certain value, right? And that is arguments. Similarly, what we pass in the value to that arguments, these are known as parameters because these are the parameters that we portray. These are the values that we put to the argument. And that is how we take input and we give input to the function. And this can also vary from. So when we have a dynamic argument, we can have multiple parameters. I'll give you an example. So let's just, it looks like this. So let's say I have add function and I have first second number. I want to print the addition of first plus second grade. First, second. Here are two arguments that are put right? If I say add one comma three, they need to print it us what? One plus one is the value of first three is the value of seconds. So that's why one plus three, right? Four. If I have to put three comma seven, then it will say ten, right? So it can have, that's the benefit of using arguments. We can have multiple values with the same processing. So we can have different inputs. But the processing is the rate processing is always first plus second, but maybe just the values are different, the input values are different. That's where the thing about arguments really come handy. In this case, we can have as many things as I want. So if I can say add six comma nine, and also it will work great. So it'll work just like that. Run. Yeah, just like that. Now I can also have it in some cases like Ten, Ten Arguments also I can have right? Depending on how much we need it. You can have as many comma-separated arguments as you want. And then you can work with those arguments here. Let's say I will just say a plus B plus C plus D plus E. And then when we call that function, sorry, we have to name their function. So I'll just say funk, funk One 2345. Then you can see it'll say one plus two plus three plus four plus five is 15. So something like this. We use inputs in function, and this is what is known as arguments. Again, just to revise everything. What goes in the assumption, what goes as a variable, and these are the variables. You can name it as you want and you can use it as you want, as you named it, right? And again, like the what you put in the definition are known as arguments and what you put in the calling is known as parameters. So just coming back to this two parts, a function in definition, those are arguments in calling what goes inside the parenthesis are the parameters. So similarly now we covered the input part. We have left the output part right? Action. We know the code that goes into it. Input, we now know that it is about arguments, it is about a parameters. Now what is output? Now in about the output will be looking at in the next episode. And after that, we will be looking into something very interesting that is, that can blow your mind. And after a return, we will have an interesting part which is about recursion. And then we will close the topic about the functional programming. Then we will go into the object-oriented programming. So that's the way forward. And I want you to practice a little bit with the arguments, play around with the arguments and parameters. And I'll see you in the next one. 30. Return: So just like we talked about, again, let's come back to our initial thing. So what are the things about function? We have action, we looked into it. We have inputs. We also looked into it in the previous episode. And now we have output. Now what is output? Outputs are the given thing right? Now, people might think sometimes people confuse print with output. No, print is not an output. Because what bring does is basically it shows the output. It is not actually output. For example, if I print this function, then I can see the value of it. And the functions value will be none. So that means the function does not have any value. That means it has not returned anything or it has not output anything. Because by default, if you don't output anything, by default, the function will have its value as none. None is the value for nothing, right? So just to write it down here. And is the default value of function when nothing is, nothing is returned or output. So that means we have to give some output. Now how to give that output? That's what we'll be looking at in this episode. Now, to given output its basic idea, and that is to write a, there is a keyword called return. So return will do what is it will return that value and output that value to that function. So how do we write the return? Return? So let's just remove everything here. Let's say I want to create a function called print hello. Print hello. And it takes in an argument called, let's say the name of that person. And then we will just say print Hello and then comma hello and technique. So it will say hello if it's shown, then hello John, if it's Michael than hello Michael Wright and stuff like that. Now, if I just run this, then print hello, sorry, print hello, then nothing will happen. I will give the name John. Say hello John, right? But this is the value, sorry, this is what we put as a print. But if I print the value of the print hello function, then it will give me none. But I want to output it. And how to output this is basically not saying print, basically saying return. And then what we want to return. So we want to return a combination of hello plus knee, right? So what we wanna do is we want to concatenate these kind of processes called string concatenation, just to write it down the string concatenation. Mission means joining or gluing, sticking two or more strings together. That's what string concatenation mean. And shrink concatenation. We will do and we'll say Hello, John. And then I will not need the printing because we just want to output that, right. We want to output that value. And now if I just run this without printing than the thing, we're just return it and it won't do anything. Actually. It won't do anything because print will only show it in the console, right? And that's why if I want to see the value of print hello function, and I can say print that hello, print hello. Then I will see you, okay, hello zone, right? Because what happened here? Let's look at it. Let's look at it in more easier way. So let's say I have a different function called f x. And it is, let's say one, let's say return x times two. So it will just multiply. Let's say. Now what will happen is when I call f two, then F2, so it'll go, okay, F2, x is two, then it will return two times two for the function F2 will hold that value, just like saying like this. So it'll say f two equals four, then it will put it as a value of it. That's what return does. It will output that as a value, just like how you work with the variables. Just like that function will hold a value. And when I print that variable, then only I can say just like for example, if I have a equals hello, and then if I just say a, then I won't have anything, right? I won't have anything. I have to print that a to see it. So similar thing, just like that. And return what written does basically is it returns the value to the function. So this means it outputs the function value to the function and function will hold that value. And that is how you return and how you give output to a function. Now by this, we covered all the details of function. We covered the input part, we covered the processing part, we covered the output part. And basically you will have a good understanding of how functions work. And functions can have all the structures that we looked at. We can have function having fun Lew mean, I can have in the for loop, right? I can also have, if I can have different things. So up to now here, like we have done everything and we want to get a good hands hands on it. So that's why what you can do is you can try doing some of the questions that I can give you. Write a Python function to see if the ease of the user is validated for a driver's license or not? Is should be taken as an argument. Okay. That's one question. Another question is write a function to print from 99 to one. Using for loop. You just do the same thing, you just have function in it and then you call it stuff like four. If I have to write a function which prints from one to ten, and I can say for I in range of ten, sorry, one to 11 because I wanted to print up ten. And then I can just say print I and I will not need x because I don't have any use of S x, then I can just call it f. And that's it. I'll just run this just like that. And then I will have it right. So what I'm trying to do here is I want to show you that you have to be able to integrate different learnings that you have acquired together. So you have acquired for loop knowledge, you have acquired knowledge, you have acquired functional knowledge. Then you want to combine all these together to logically think how it is working, right? And yeah, that's it for the function. Now, next part about function. Try to do this two things with functions. I'm, the age should be taken as just like this. And then you will just do IF is like if is and stuff like that. It's the same thing that we did with the previous one. Now in the next episode where we're looking at something called recursion. And recursion is very powerful concept and very important concept and it will be very helpful. Recursion basically means an iteration of a function, which we'll be looking at in more detail in the next episode. So I wouldn't want you to practice this once. And then once you are done, then we will move on to the next one. I'll see you in the next one. 31. Recursion: The recognizance and what our recursion and how it works. That's what we'll be looking at. Before this. We looked into functions and how function actually works. And we looked at three kinds of programming that we have just to revise everything. First was structured programming, Shuttle program. Second was our functional programming in third was object oriented programming. And object oriented. Yep. So now we're looking at the functional part. And in the functional part also, we said that functions are those which have input process and output values, IPO. And also it has a definition and calling just a device, everything and stuff like that. Now, one more thing in recursion is, is basically the concept of, sorry, one more thing in function is the concept of recursion. Now what our recruitment and how do they actually work? That's what we'll be looking at in this episode. Now, let's understand what it actually means. Literally. Literally, recursion means something like, for example, like literal meaning of free cousin is to reoccur. It goes in, comes from a root word. And it means to occur again and again and again, reoccur, recur, right? And that's what is weaker and weaker means to recursion, right? And that is the whole idea of it. So if it reoccurs, then that means it's a recursion. Now, how do we reoccur? That's the thing that we'll be looking at. Now, the thing about recursion is it only works with function. Only works with functions. How do they work is by how it works is that the working principle of it is that the function will call itself in it. So it's like saying, I am calling myself, that my self is also calling myself and that myself is also calling myself. So it keeps on going on and on in a vicious cycle. And that's why the functional programming to recurse only works with function because it has the call itself, right? And definition and calling only works with functions, and that's how it works actually. Now, how does this work? I'll show you an example. So let's put an a function called name. And I will just say print hello. And then what I will do is instead of calling it after printing hello, then I will call it the name again. So this means what it will do is it will again call that name and then print hello, and then again call that name, and then print hello. And again call that name print hello. It keeps on going on and on and on. And if I run this, nothing will happen because we have not called this function. Now, if I just call this once, then you can see it will keep going on and on. And then it'll say rigorous inherited providers and Eric has an error. And that's because an era is of maximum recursion depth exceeded while calling a Python object. What this means is that when running the recursion, the maximum depth, this is the maximum depth. The depth is calculated dynamically and this is created because it, to stop it in recording forever, right? If it finds that it is recurring forever. And for a long time, you can see it's really for a long time, then it will say, Oh, maximum recursion depth occurred, right? So that's why we will now need to put an end like this would be a stop, right? There should be one-stop that has to stop it. Just like in while loop, there used to be counter variables, like counter variable, then we would just use that as a comparison operator. And then we will say when it falls like that. Similarly, what will we do is we will create conditional statements in the recursive function to stop it. And how do we do that? Is basically firstly, we have to create a counter variable also. But now in this case of arguments, because we have to pass in the arguments again and again, right? So if counter variable is 0 in the first round, in the second round counter, So B plus C plus one, right? So that should be increased by C plus one. So that's why what we will do is we'll say C plus equals one. And then now the new C will pass into the old C. By default, the value of c is equal to 0, right? This is a giving a default value so that we don't have to give anything here. If an argument has a default value like C equals 0, then even if we don't put it here, then it's also fine. Then it does not need because it already knows, okay? If nothing is given, then C is equal to 0. Okay, Now just doing this one to anything because still we have not put that conditional statements. Then we want to run our name. Only if our, you know, our count is maybe ten times. If I want to run it ten times, then when it is 11. So when C is 11 then I don't want to run this, right? I don't want to run this. So that's why if c is not equal to 11, only run this whole thing, right? Otherwise, then we just stop it. So if we don't call anything, then it will automatically stop because it was running because it was calling itself again and again and again. Once it goes out of that cycle, if it is else, then it won't call it the name c and then it'll stop. So just like that, it will print hello for it then times 12345. In this case it will be 1167891011, right? Because why is it is because we started from 0 and up to 11 means we have 1011. We can say ten. When it reaches ten, then it will stop it. So this is how you actually work with functions. And because now obviously it is a bit complicated to understand and this is a bit off. You have to use a bit of your logic for this. So that's why I've created basic idea of how it looks like here. Now before this, I would want to, I want to demonstrate to you how we create this thing in our Python and then we'll go back to that graphic. Alright. This is how you actually create a recursion. I would want you to pause this video and try to print from 0 to ten. Not Hello, but maybe print 0 to ten. And I want you to try that using recursion. Recursion is also a form of iteration, by the way. Like we had a control structure and we had a situation going on right? In control structures, we had deletions and four iterations. We had loops. And recursion is also one of them. So it goes in is also one of the iterating bad thing process. So I would want you to pause this video and try this recursing on your own. Then we will move on to showing you or demonstrate to you actual real world program. Alright? Alright, I hope that you tried this and tried to print from 0 to ten. And I hope you didn't have any issue with it. Otherwise, we can just, it's pretty simple by the way. You can just change that. Print hello with C, then you get that, right. Okay, so now that we have this, now let's remove this. Comment this out. Okay? Now, let's say I want to create a function with recursion that calculates numbers factorial. Factorial in mathematics, this comes in mathematics factorial, what it means is basically, factorials are those numbers which are multiplied together. If I have five factorial, then it will be how we calculate that is five times four times four times three times two times one. And if I say four factorial, then it is four times three times two times one. So what it means is like four, we'll multiply itself until it reaches one, and then the value is the thing. So for example, this would be then 120. One 26, yeah, One 24 factorial would be three times is 12 to two times this Twenty-four. Twenty-four. Again, three would be also something like that. So it'll go, keep going on and on. That is how factorial calculated. And we want to create a function called factorial. And it obviously has to take one argument number, right? Because then it had to check factorial of that number. Now the logic of this factorial is that the number, the numbers would be. So for example, if the number is, let's say I'll just nothing here for now. And I want the factorial of, let's say five or folded thing. So why do you need factorial of four? What do we have to do is full factorial is again, what is four factorial is four times three times two times one. And what is three factorial? Three factorial is three times two times one. And what is two factorial? It is two times one. What is one factorial is one times one. And what is 0 factorial? 0 factorial is always one. So 0 factorial we know. Because 0 factorial is a well-known term. So that's why we can say if number is 0, so when the number reaches 0, then we want to return one because that's the value rate factorial of 0. So if we say factorial 0, then it should return one because that's what we knew. All the thing we don't know, but that's what we know. And if I want to find the factorial of four, then what I can do is I can say four times factorial of three. Can you see this? Sorry, four times factorial of three? Because if I see this three times two times one, it is actually three factorial, isn't it? And also what is three factorial? Three factorial is three times two factorial. Two factorial is two times one factorial. What is one factorial is one times 0 factorial. 0 factorial is one. And that is how it works. And can you see a common pattern between all these? The pattern is the algorithm behind this is the number minus, sorry, number times number y minus one factorial, isn't it? It's number. Then let's say it's full four minus one factorial. Then we will get how much? 244 factorial means four times three factorial. Three factorial means three times two factorial. This means that if I create a thing called factorial of number minus one, then I should get actually the same thing, right? So that's what we can do. If that number is not 0 for everything except 0, then what do we do is we return that factorial, right? So we return because full factorial means four times three factorial. So that's what we're doing. Because if that's not 0, then what we're doing is we're saying, okay, Number, then factorials. If we're saying four, then four times factorial of three, right? Then what it will do is basically it will call that three factorial again. It'll call with num three. Then it's not that it will again say three factorial, it will go in this form. And then when it is 0, so when the number is 0, so it'll call factorial of 0 here. In this case, when num is one, then one minus one is 0 factorial of 0 is one. So this means this will be returned as one. Then the return value will be keep. This will return here, means it will replace this value. And one factorial is one, so it will replace the value. And two factorials means to write. So this will replace the value and three factorial means three times two is six, so this means 64 factorial means 24. And that's how it works. If I just run this. Now I have to print this obviously because that's the value that we returned, right? If you remember our output, I can distribute. Yeah, so 24. And I can also do something like five is 126 would be now 120 times six, which is 727 to eight times seven would be seven factorial, right? It will keep going on and on like that. So this is how you create a factorial number. Now, let's look at the same thing in more pictures and more descriptive way. Same thing. Okay. So you remember how we created this factorial of four, right? And we said that firstly factorial of four. So what this did was we said Okay, for is out num, num times factorial of three, then we don t know the factorial of three. So that's why what we did was we went down into factorial of two. Factorial of two also we didn't know. So that's why we went to factorial of one. Factorial of one also we didn't know, and then factorial of 0, factorial of 0, we know that's why it is one. It returned one. So it will now go back again. It comes down and goes back. And now factorial of 0 is one. So one times one is two. Factorial of two means, sorry, one is now, sorry, factorial of two has this value of two. And factorial of three has this value of six. Factorial of four has this value of 24. And then it will return like this. And then it will say, okay, factorial of four is 24. So this is the pictorial representation of the same thing. Now you can screenshot this also added somewhere, save it somewhere so that it's easier for you to understand leader. And it's basically not that complicated if you see it in a proper way. Obviously, you have to pay a very attention on how you are actually coding it. And this is about numbers. Now, if you wanted to do with strings, then that's a different story. We have to use indexing and slicing straight, especially slicing or indexing. So we have to slice the chunk of the goods as just like that. That is how we do actually recursion. And recursion always, again, summing up everything. And let's try to understand what goes in R basically. Because in those values, that comes in, oh sorry, iteration. That works with functions only. And recursion works by calling the function in itself. For example, if I have a function e, then it will call itself just like that, right? So it's like saying something like I am here and my clone is there. And that clones, clone is also there. So I'm asking my clone, Let's say, oh, what is the factorial of five? I'm given five. So what is the factorial of four? I want to know that clone asks two other one. So what is the factorial of three? And then again, it asks for another one. What is the factorial of four just like that. And then it again, ask for another one. What is the factor of 0? And then that person knows, that client knows that factorial of 0 is one. So it will go back saying, okay, that is 11 times one is two. Sorry, 11 times two is two. And then two times three is six, and stuff like that. It'll go just like that. So this is how actually recurs in work. And the main thing to understand here is in recursion, we always have to work with conditional because we can't just call for eternity. We have to stop it somewhere. And that's stopping will always be determined by conditions. So sometimes condition might be num equals zeros, sometimes condition might be something else. So we have to try to understand where do we actually want to stop that factorial? Or, sorry, where do we want to stop that function, right? Where do we want to stop that function? And where do we want to stop that? Because that's where we will just put the conditional statements. And it is why it is very important for us to know. That's why I put the conditional statements in the first place before coming into recursion because it was very important. So yeah, that being said, I think the next chapter will be owned and object-oriented programming. So we'll be looking at more detailed now. We're going really advanced now. So I would want you to really practice a little bit more. I would want you to create functions for, let's say, like what you did with loop, you can try with recursion itself. So Create Function or greater recursion. Because you need to check whether or not to print from 19901 in backwards. So you can try this. And once you are done with this, then we will see you in the next one. The next one will be on object-oriented programming. So we'll be covering the details about object-oriented programming in the next chapter. So that's it for me. Now. I'll see you in the next chapter. 35. Object Oriented Programming: We were looking at the object oriented programming as we discussed in the earlier episode. Now, what is object oriented programming? Let's understand that first and then we can understand what our object on programming, sorry. Object-oriented programming. Alright, so object-oriented programming, as the whole thing says, we, again, coming back to our main thing, we had three kinds of programming. We have structural programming. Obviously we have more. What we talked about, structural programming. We had functional programming. And similarly we had object-oriented programming. Right? Now. The structural programming works with, deals with structures, right? I mean, it is a structured form of programming. Normally, functional programming deals with functions, so it has functions in it, and then it works with function in it. And object oriented programming is, has to do with, as it tells object ODE integrate, it means it has to do something with objects. Now the question comes, what is objects? Objects are basically, for example, also an example. If you, oh, just the previous one. The records in part. Just an example of this. So print Hello World and recur. So when I run this, you can see an error message that says maximum recursion depth exceeded while calling a Python object. What is object? That's the question, what is an object? Now, object is something to do in Python as a variable or a value that holds the clauses. Okay? So we have to understand the terminology is here for the object on your programming terminologies. So what is actually objects? Objects are the values or variables that we can see. Variables contains classes. Now what are classes? That's a different story. Classes are how we actually create objects, object oriented programming, everything, right? And the main thing about classes is that I can write it. So a class is, you can call it as the mean machine of the program, the OPP, object-oriented programming. Now how are you going to understand classes and objects? You have to be very careful while understanding classes and objects. I will create an diagram here so that it will be easier for you to understand how it is actually. So let's say I have a class called car. This class has, let's say, different things. Let's say a has a fuel and also it has and also it has something like, let's say wheels, wheels. And it also has other things. For example, it also has color in it and they have their own column. Similarly, final thing that it has is more thing. And that is, let's say these are the things that a car has. This we can call it as a blueprint, isn't it? This is a blueprint of that car, right? So we'll call this our blueprint. We'll put it in a big square. This is sorry. It will come to one company and just put it in a text form somewhere here. As these are our blueprint. A class is, you can consider classes as the blueprint of something, an object. Now, what it will do is it'll create a car to car. So car with its properties. So its engine would be now, Engine is 200 cc and fuel is factual, and wheels is Louis. Color is red. So that is one object. So based on those properties, when we create. Some actual value, our actual thing, when we create an instance, we call this process as Instinct. This process is known as here. This process is known as ins. And see. What instance striation actually means is basically to create an instance of that blueprint, we create an object. So this becomes an object and we can call it as like this. We can say, okay, E equals. And then we can give the Python object. In Python we can say a equals and that object. Similarly, we can create a similar object, object B, let's say. We can say, okay, now the engine is maybe not 100 CC, but 1 thousand CC. Field is not know petrol but it's electric and will not alloy. But maybe let's say brass and color is black. So this is a different car. So this means I can give it different value or variable. And this, we can call it as b equals this. So you can see this is also an object now. So now what we can understand this as, objects are the things that told the clauses and what are the classes, then the clauses are always the values. Sorry, clauses are always the blueprint of that. I think this is the basic way in good way to understand this whole thing. Class will always be an blueprint of something and it will hordes something called, these are called in object oriented programming. All of these are known as attributes. Like the engine, these things, these are known as attributes. Put it here. Is our known as attributes. Attributes are those. I'll just make it. So these all are attributes like engine, fuel. We use these colors because it's an attribute of our blueprint rate. And the value that we put the parameters of those attributes. This is how you get, understand what is in class and what is an object. So these things are, now these things. These things are an object. And these things, the upper one, the plus, these are the class, right? So the difference between class is the same thing. Object is the value that holds that class. And class is the blueprint of that object for it. And they have this mixed relationship. So this is how we can define an object and clauses. That's how object oriented programming. So it has to do with classes and objects. In the next episode, we'll be looking more in detail about how actually can we go with our class in Python and how we can create an object? And also we'll be looking at how we can create methods and how we can create different methods in our Python program. So that's what we'll be looking at in the next one. So till then, I think you can just go in the internet search a little bit about object-oriented programming, gets some idea of it. And then in the next episode we'll be looking at the syntax or how we write the classes, how we write the object, and how we actually execute the whole thing. So, yeah, that's it for me in this episode, I would want you to practice more and more and more. Again, like I think I have not missed it to see it in any episode, you must practice in practice is key, right? So I'll see you in the next one. The next chapter will be on classes and methods. Happy coding. 38. Project 1 - ConsumerReports Website: First project of web scraping with beautifulSoup. And we'll be using customer reports. Also. They also call it ConsumerReports Website and see. Try to scrape the information. Alright, let's do the preliminary required libraries first and then we can move on. But before we move on, I would like to show you how the customer report ConsumerReports Website looks like. It looks like that, normally, just like that. And we can basically skip anything. So for this thing, what we'll be doing is we will be basically scraping like the best deals for under $550. So we'll be separating these two in two parts. So one is best deal under $50. There's the first thing that we'll be doing and second thing is a bit complex, will be going through all the products. From here, all products, and will ask the user to put the products they want. And then we'll just go through that and list out basically all the things that are listed here so we can think how we can do it for, but for the first part, Let's try to just do it. The best deals under $50. That just what came to my mind. But we can reframe what we thought. So let's try to go here. Insight. Let's see what they have. So here we can get the list. There's one and what else can we do? Here are the names of the things and kitchen tools. Okay. Okay. So let's do it then. We can do it. All the best deals. Not just best deal under 50, but all the best deals. Okay, let's do it necessarily invitation. So we import HTML5, lip, we important requests. And finally we, from the S4, we import to through. Alright, let's try to get the score here. So we say Russ equal requests not get. So if you remember, we first want to get the detail. And once we have this, then we want to create a soup of beautifulSoup, width, restaurant content as the content. And at CMO five blip as the parsing library. Let's try to pray at print the soup dot pretty five once. To just check everything works. Everything is working all good. So let's go into desktop, go into Ceiling Commission course. Let's try to present three main.py. Alright, so basically we can get the whole I'm ConsumerReports thing. So what we can do now is we can find all the details inside this here. So see all the deals. We can actually go to this website directly, this piece directly. We can find everything. Me. Be a nice idea to just follow the links actually. Okay, so let's inspect and see what the best still under $50 looks like. I'm, so it's a class layouts hoping image link still does a class. In this sloping link. We have to think a little bit what that is. Let's try to come to this main part, which is just, which has the ID of soft deals. So let's just get that deep first Div with an ID of subtitles. So we come here, we see a shop deals equals. I can see soup dot find. And I want to find a diff. And our attributes ATTR is a id of shop deals. Is that correct? Let's check sharp sharp tools yet. Let's try to print the details. Let's see if that works. So we can see that. And looks pretty good to me. Alright, so inside that what we want is basically all the iris and the links. That's what we want. Basically, under first top five deals, we can get So what we need to do is basically get all the areas insight that so what we can do is we can see diff, shop deals dot find all all the a tags. So let's just go through for I in find all. Then we want to print the I, but then not everything but just address of I. Let's try. So we can see all the links right? Now. Obviously, the links are without the ConsumerReports. Because if you see the link and if you click on that, then it opens ConsumerReports baseURL than that. So what we can create is like a baseURL equals that. We can actually pass here the base URL. And then here we can see print the base Your L plus that. Then if we see this, you can see it's with that. This again. Now we can see, we can see the whole link. So if I go to that first link, then it will be about the best deals under $50, exactly how we wanted. All right. Looks pretty cool and looks like how we wanted it. Okay. Now, what we want to do is we want to open each of them. So we have our list of links that we want. So let's save it into a tub deals list. Let's say top deals equals the list. And we just want to append into this list. So dot, dot, dot append this. Alright? So once we have the best deals list than what we can do is basically we can go on each of them and get maybe the, you know, we can, maybe what we can do is we can get we can ask the user, we can get these things here. More deal. Yeah, I think it would be an interesting idea. I'm just thinking no, to ask the user if they want to go into countertop appliance or a kitchen tools. So we list out here, we ask the user what they want. And then we basically saw the products of that particular category, category. And to do this, what we can do is we can firstly try to find, and firstly, let's try to find if that is in all of them. So what I mean is if that is relevant in not just $50, things also like best deals on home and kitchen products. Yeah. So we can see that kind of pattern in all of them. So I think we can do that. Yeah. And bought for TV. Tv, we don't have it so we can take out the TV. I think we don't need to go through the TVs. So let's see. Best TV deals. We don't need it. So what we can see is we can simply see if best TV deals in the eye, then just to continue because we don't want that link because it does not have the same sections as normal. So let's try to see how they do, how they look. And let's try to print the top deals and how they look on it. If I just run it. And so we have that. And if I see this TV deals, electronic computers, actually liked that. It should not have printed five. But for me to where I came to this, we can see also if it starts with electronic, this one here. So if it starts with this. So what we can see is if I dot starts with Electronic computer than we skipped this the trip is none. Try this. Okay. When this was before, what we're doing is creating electronic computers. Think I know with to see ties I addressed because the link is not I but it is actually I Esref if it is in iris atrophy, that's the thing. Yeah, exactly. So we don't have now our five, but now on the fourth link, correct? Proportions of $100. So we don't have the TV thing again. Awesome. So we did that. Now what we can do is we can come here right here, and then we can see can get the Section links here. So what are these sexual links? Let's inspect, get the Section Links basically. So it is inside the intro section. Okay, it is inside the section integrals. So let's try to get that first. So what we do is for each link in the top deals, then we go through all these links, just like how we did in the response is to is going to be link. And then same thing. So two, again would be two would be risks to content. Then we see intro, intro section equals we get the soup to and then find. But now not the diff by what do we want to find? We want to find the sections. So Section with an ID of intro. It's just go here, D of intro. So we have our intersection. Let's try to print this intro SEC, and I will just break it so that it does not know, go through the loop. Just gets the first one link first. Yeah, So we have our intersection. We just need the edge ref of it. Okay, Now what do we want is all the lists of these things, and this is, seems to be insight. These are all the Etags into this thing. So let's try to get all the Etags. Same thing again. Find all 0s. So what we want is from the intersection, find the, all of the ISS and print those. So let's try. So we have our is now, what do we want is the text. So what I can see is, I can say for I in find all the text. Ok. Now I think the last one we don't need because it's not I think, related. So what we can do is we can see find a more deals within that section. Then eight tags. Maybe from here it got it. Show actually should not P. We can this P tag. We don't know what that P tag is. What we can simply say is then we can simply see just We don't want that, so we can just take it out to data. Okay? Now we can ask the user which one he wants to see countertop appliance, the first and last I think we don't need and so on. So what we will do is we'll say Section text takes lnx equals naught links, but Section intro list. And we can append into this internalised. And we have another list called, well, let's create an Dictionary and just have it, the links as their values. So we can take intro dict, dict I text would be equal to I ref. So by doing this, what we do is we get, finally, if I print the, I, sorry, print the intro dict, then we can see it. It will be a dictionary containing all the options and their links. So that's good. Now what we can do is we can simply say for an intro dict object, maybe we can remove the first two, but let it be. We can just ask the user so I can see it. Print. We can have a counter variable also C equals zero so that it has always. See. We can also see the plus equals one. We can ask the user choice equals input enter, which you want to see. So let's try this. So it says, okay, into which you want to see. And what we want is if it says three than it should, take the link and open the kitchen tools. Let's try that. So now what we can do is we can see the maybe it would be actually to just put the name, actually no number, but just asking the user for name into which case sensitive. So for example, what we can do is we can see link to open is gonna be interdict and then the choice that we have. So let's print that link to open. So we're stuck. So it says, Okay, kitchen tools. Then it says that, right? So our base URL we need. So baseURL again is that link which we had. So what we can do is again, a rush to 2.1 equals requests dot get it all. It is always that we always want to use requests and get and requests and get. So we just because we cannot automate the things right, we have to always request and get the HTML and then work with that. And another would be soup. Soup 2.1, the T, and rushed to underscore one, the content. And once we have that, then what we can say, let's say we have it in the top appliance, then we can see that we would need than Mr. the this name and then this name and then maybe it. So let's see what we can get. Ludus, therefore, I know it's a sea of the name of the same. So what we can do is we can get the idea. What can we get thinking of deve to cause? Countertop up lines. So it has ID of countertop appliances are always with a low cases and hyphen. So I can come here and see it. It's gonna be the choice. Choice. But then all in lower. And what we want is I can show you all. So for example, if there is a which is someone says kitchen appliances, kitchen tools, than what how would we want it is kitchen tools because that's how the IDs are. So what we can see is I can say E dot lower first. And once we have a dot low, I can split this. Once we have that splitted into two words, I can join this with a hyphen. So I can see hyphened or join, join with that thing. Then they can get that. So I will use that particular thing here. So I'll just say Institute of a, I'll just say choice. Then we have our ID that we want to search for. And it is of a diff, right? So let's try with soup to one dot find. It's a diff. And at TRS attributes or it, is it. Alright, so now we have our soup. That is awesome of second thing also. So we can call this a DIV, DIV off productive, productive products. Now, let's try to go ahead and print the dip products and look at if everything looks good. Week I'm here with this thing. And try this again. Okay, Now, let's try for our kitchen tools. Kitchen tools link. We want to open the link link to open that up, but not with just our query. It should be Link Plus link to open because it is just slash after the hashtag. So that's why, Let's say we want to kitchen tools. So we have our kitchen tools here. And so that's how we can get it. Now, I think the next things we could do would be go through the next step after this and stuff like that. So I would leave that here because this would be too long. And I gave you a tentative overview of how you can do it. Now, you're part would be to use this and just display the cases. You can put this into the project also and people can see and get inspired. The next project would be on creating a Craigslist scraping side. So we'll be working with Craigslist, craigslist and trying to scrape out some information. So today we tried to scrape out some information from ConsumerReports and we were able to get the links. Click, use that links to get other sections and stuff like that. So you use the same concept on other things also. Alright, so I'll see you in the next project on Craigslist Website. 39. Project 2 - Craigslist Website: Our second project for Los Angeles, Craigslist Website. The Craigslist Website looks like this. Basically, it is a listing Website. You can list your vacancies, you can list your ads about your productions, stuff like that. You can list basically anything. Like you can see a real estate, all of the things, right? So there's for Los Angeles, for different places and states. You can find different year like that. So you can find for Chicago, Santa Maria, San Diego, and stuff like that. So I'm just using Los Angeles here for an example. And let's say we want to check. I'm just thinking no, here. Let's say we want to check what kind of real estate deals are there. So what we do is we can come here, open it and take that as our make it. So once it's loaded, loaded, and let me try this just like that. So it's a real estate. Alright, so what I can do is I can take this as our base URL. This was already from our last time. So I don't need that last part here, so I can take that as our base Yoda. So this is for reals T Craigslist Website. So once we have the Craigslist, Craigslist Website, what we can do is we can come back here and we can basically list out all the real estate property deals behalf. And we can do this by basically going here, inspecting the elements. Let's see on the properties. That's the label. If we go little bit ahead and check. So it has a class, class of col search result. So that would be something we want. We want an ally. I'm actually this moment. We want a or L and then we wanted to find what we want is we want to get the Div with results class first. So Dave results equals souped up fine. We want to find a Div with attributes. It was that it was a class. Once we have that diff than we want to find DIF results dot find and or L. Or L. Again, attributes. Attributes of class. Be defocused straight BD for different, just check. Then we have inside there BD for this TO exactly. Alright. So once we have that inside that, so let us then find this is an OL. So what we want is insight oil. We want to find all the allies with an attribute of, let's see what the attribute is. The attribute is basically CL search result. So search result. We can see here clause with the Cl search result. What we can do is for I in for LIN that we have each of that list. Then we can basically get once the title of this lie and see the things. What we do come here, print the dot title. Let's try this. I also wanted to check the results. How many results are there, so we can do that later. The trade-off come here and firstly try this. Nonetype has no attribute. It didn't find the different results at the firsthand. Okay, interesting. This Proteus piece Maybe if we did all, it couldn't find something. Because right now and results in true? No. It didn't phoned. To mean we can erase it. So let's try with search results, peas, one as an ad than in a try with different options. Let's see. Still straighter than print the soup first. Check, everything works. Okay? Yes. So we have our allies and List. So all of these List we need actually saw this ray to decipher this list to leave it. It is inside the body tag. Okay. Okay. Yes, I think it does not really anything like that. We can directly come here and look for directly. So we can directly look for a class list. So right here, it's an oil directly like this also you have to see all these like what is the possible outcome? If one way doesn't work, then we have to try to find another way. So all of that particular class, so let's try to find this. This means diving is not there. So we can forget diff, we can directly come to that with soup. And class is going to be this static. And once it is there, then we want to find the class of lie of disk. Same class. I'd think that's what we want to do. So we want to find the ally of the same class and then we have the title or not. Let's see. We don't have the title, but we have yeah, we have the title. So let's try to run this thing. Let's remove this super pretty five ones and it's okay. So now we have our titles of all the listings that we have. And maybe it would be a good idea also to have that listing price. So what I can do is, let's see the soup again. Once where the prices are and how it is structured than we can all work. Then inside that lie, we have a link, we have a Div with a title, and we have a Div with details, and inside the DIV we have price. So we can use this Div with details so we can find a diff with the details insight. So I can say la dot find it diff with a class. Class details, details. This is gonna be detailed stiff. And then we have a price. So inside here, inside this day, if there is a Div with a price. So let's come here again. We find that inside the details deve, we find with Price, price DIV. Once we have the price stiff, then we just take the text offered. So I Kenzie print the title and the price divs text. So that's how we can decipher and scrape the elements. Let's see. So at the end, we can see all of the prices. So we can see here $550,000 for every few thousand dollars, $3 million, 909, $9,000. So basically we can get such information. So making this information more having this locations would be your thing to do. So you can add this as a project and other project that you want to do. And at location, at images links and like that. Alright, and then after this, I think we're almost finished. So I'll see you in the next video. 40. Stock Analysis using Pandas and API: Looking at the real-world application of EPI and pandas will be using Stock Exchange analysis report with pandas. And this video is going to be a little bit in detailed videos. So you might want to go through it and also do it on your own. Because then it'll be really helpful for you, right? Because at last it all comes down to practice. Because if you just stay there and see it and then not implemented, then it does not make sense, right? So it's important that you practice this also implicate what? I also do it in your own also, okay, So for the stock exchange API, so we'll have to, so this is how it works. There is a there's an API server that will give us our stock information, right? Like all the details or the tickers, all the symbols and close value volume seals, all these things. Open, close everything. Based on that. We will have to create a client, which is our program, which will then send an information, send a request and get the request response, and then soak up all this information in a Pandas DataFrame. And then we will be working with Pandas DataFrame to manipulate those data and even plot those data and visualize those data, right? So this is going to be an int, detailed video. So I would also want you to go along with me. So for this purpose, what we'll be doing, this did was I just searched for Stock Exchange API and I found this alpha vendors, right? So this is a good one. So we can just use this other vendors. Now obviously there are others also, but we will just use all fermenters in this case. Then obviously we'll have to firstly get the API key. So I'll just go and get the API key. Then I would say software developer. I just say educator, organization. Let's see. Then email. I'll just say COVID. Now just for an order robot, tractors. It free API key. Just like this also, you can also get your own API key. So we will get this API key over here, which we could use in our program, right? For us to then use it. We would obviously have to copy this and paste it somewhere. So that's why I will come back to our now obviously you also need the Jupyter Notebook, like we said last time, right? So I just create a new file and Jupiter Notebook, call it stock analysis. And then I'll just say API. Api underscore key equals. This is our API key. So now what we can do is we can go to our documentation, API documentation. So you can just go to event is CO then stock API documentation right from there obviously now things right? So then what we want to do is we want to go to our, to see what kind of examples do they have for the links. And here is the link for Jason output. Then we will have something like this. I can say query, and then this is our URL. And then there are things like function equals time-series entirely about that. Here is what it is. This API returns intra-day time series of the equity specified covering in extended trading house with applicable intraday data is derived from securities information. So this is like the for the day trading thing. Then what we can do is we can just go down a little bit. Then obviously here, they also have this requesting, which shows how we can send these things also. Now what I can do is I can just go down a little bit just to see if they have non-simple things like for every Aldi applicable things, or do they only work with symbols? Time series deviates as 2D symbol is necessary in this case. So we can use that. Let's system. Okay? Function equals this, something like this. So if I want to search for our symbol search, then I can do that also. Because, excuse me, tickers. What do you have to do is obviously go through the documentation a little bit so that you know a little bit about what is going on. Okay, So anyways, I will just use the previous one, like where the symbol is necessary. I would take the daily ones. So just search for this daily, I think. Then I will just go down. I can then copy this. This is for UK, London exons. And let's see what companies and we choose. So these are four different kinds of companies. You can see the symbols here. So we'll just use this here for now. So this is our URL. Our base URL is, this URL is equal to just up to query, because this function should be gone, gone through parameters. So I'll take that out because those will be sent as a parameter. Okay? Now that we have this, now, what are the parents do we need? So let's write it down all tuna dictionary format. So the function, our function is Time Series D because we need to really portray. Then we have our symbol. Symbol. We're going to ask the user for this. Also, we can see choice equals input. Enter. A single user will input that and then I'll just pass in that. Then our API key. So API key equals. So that is our API key up there, right? Api key. So our params, everything is done. Now obviously now what do we have to do is I will just run this syntax. So let's say IBM for now. Now, all these values are set right? So now next what we can do is we can import our requests library and send our request rate. So what I can say is import requests and response equals request nor can get, obviously this is a good thing because we are getting from this. Then we will just say baseURL with Pat MPS equals three. We're saying basically parents is the sperms that we sent. And let's see how the response looks like. Let's see. Okay. It says two hundred. Two hundred means. That is right. It is correct. So let's see the content of it. How it looks like. We have all these information here, all these metadata, all these things, right? So what do we need here is we want to convert this into adjacent format. So let's try to convert this into adjacent format. Okay, so now we have all these information like we have metadata, information, daily prices, volumes, all these things. Then we have nested like where is the information is in the time series, daily? In the time series, the leaf I see. I will have to then put this in a data. Okay? So now I have it in the data. What I can do is I can just run this data. So if I say data time series Daly here, then I should get all these values rate. So if I say data time-series daily and run this, you can see I'll get all these opens and close for all these dates like this. So I will have all this information here. So this is for IBM only. So this will only works with certain symbols. So what we can do is we can just say for other, if I need four or any other things. So if I run this again, and let's say MSFT, which is from Microsoft, run this again, run this. We have for the Microsoft now, here. And run this again. We have our time series data. Now obviously this is a bit complicated because the same things are repeated here. In this state. Open is this, hi, is this Lewis discloses this and volume is this rate. That's what it looks like. Now for us to convert this into. Now, if it would be a DataFrame, it will be easier. Now if you go to a DataFrame, things and search for Jason, pandas and search for Jason. Then you can read season and convert it to a DataFrame. So how can we do this is basically, I'll just open this. So you can see there are different things and there is read this in red. If you open this, read Jason. You can see it'll say Pandas dot read Jason will just read diseases. So what I can do is I can just say time series. This is our thing that we need, right? So that's why we will say Jason equals this. Then what I can do is I can create a DataFrame by saying PD. I should actually import pandas also now import pandas as pd. So I will just make it as pd. Then it'll be easier for us to locate. Then I can, I can say Pd dot Zc, vc, right? If I run this, decent is not defined. Sorry, we have to run this again. Okay? If we go invaded file path, okay, it asks for expected decision string format and just pass in, orient this because that's a string. Let's see if that works. Okay, that didn't work. So what I can do is I can use, this is not adjacent, but this is a dictionary in this case rates. So I can, second thing I can do is I can do for dict. Dict is possible. Scenario. I can say Pd dot from dict. And our dictionary, right? Because that's the dictionary attribute from linked. Let me see again dictionary. Okay, Let's try to find that out. And this would be a blank DataFrame, right? So let's see how it looks like. It's about blank dictionary. Now what I can say is df dot from dict. And our dictionary is Jason. Right? Now you can see it has the dates here and then our columns here. But we want it opposite that. We want open, high, low, close volume and then our dates here. So I can do that is basically I can create, save this as df, UDF. Then what I can do is I can say df dot transpose transpose will just like for these two. Alright? So if I run this, now we can see it's dates. And then here open, high, low, close volume. So that is how it works. Now. Again, like how we did this was let's revise back. So we firstly opened our a free account in our stock at alpha Vantage, and then we got some API keys. We got the base URL, and we got the choice from the user, like what, what they want to choose. And then we then requested that with the request dot get and baseURL with parents that we are that are needed here. And then we recorded that response and got that response to convert into season and saved it into data. Now obviously data has metadata also. So that's why we remove that meta-data thing. And then we just took that time series Daly. And then once we have the time series daily, this is from here. So once we had that time series Daly, we imported pandas as pd. And then we created a new DataFrame with blank DataFrame because we can't just convert a dictionary directly, we can change it, right? So we have to have a blank DataFrame and then we convert our dictionary and then put it into that DataFrame. And that's what we did and we saved it into df again with that new Jason. And then we, because it was re-encoding most opposite, That's why we use DFT or transpose to transpose it. So we have to again save this to a df so that the new one is updated. Once we have this df now I can just say df.head. I get the first five columns. Okay? Now I have all this information. So what I can do with this information, we can do multiple things with this information. We can firstly know what is the date range. We can load in this date. What happened for this? We have to convert this into a new, new column because this is an index and index cannot be changed. So what I can do is I can make it a column. I can just say df dot reset index. It will reset the index. So you can see now the index is our date and a 01234 has been changed, right? So I want to save this again to df. And we have our df with the reset index rate. Now what I can do is I have to convert my name of the index to something like relatable, right? So because index, I could also use index, but then I have to change it. But before that, what I want to do is I want to convert this into a datetime also. So these are the two things that we need to do. Firstly, I have to convert this into a datetime. And then just a minute. And then I have to also change the name of that string, like the df frame. So firstly, let's rename this to something like understandable, like maybe did or something like that, right? So what I can do is now I can just see in order for me to replace this and rename this, what I can say is I can see df dot rename. You have dark rename. And then I would have to say columns equals the old value. Like for example, index to a new one. So one would be maybe deep to fade. And then I can just say in-place equals true. This will just make it intact. And let's see. If I see now under df, now you see the index has been changed into data. We also want to change this to 11 dot open to open only to high to high only. And we want to remove these numbers. So that's why we will do this two here also. So what I can do is I can just add more key value pairs. So one dot open, so it'd be changed into just open. And similarly, two dot highest would be changed into high. And similarly for three laws should be changed into just low. And finally, four dot close to be changed into this clues. And lastly, five dot volume should be changed into Williams would be changed into volume. Right? So let's see if that works. Run, run. So we have all these things. So date, open, high, low, close and volume. So now we don't have these unnecessary things like we don't have 1234 like that. So now what I have to do is now date is might not be the DateTime, right? So what I can do is I can just see as type. Then I will get it. Sorry, it's a type. Let's see the documentation again. We wanted to check the types of it. So that's why the types, the types Series object is not callable. Okay, Let's just see type of df. Let's see how it looks. It looks like it's a DataFrame. I just go to Google and search for, um, DataFrame. Dataframe types. The type. So we can just say dataframe dot D types. So just like what we did, df is our DataFrame. So D F dot d types. So we can see deed is object, but it has to be not an object, but it has to be a datetime. So what I can do is, like we did in the last one, we have to select that date. Column D is equal to, we have to change it to datetime. Datetime. And what do we want to change it? Df, dy, dz. So that being done, we can now check the types. Now we can see date is our datetime object right? Now. Similarly, we want to change all these to floats, right? We want to change it to numeric. So that's why similar to datetime, how we can change the to Florida numbers. We can just say to numeric, because a liter object is like just like string format, but we need to make it calculated. It should be able to calculate. That's why What does this say to numeric? And this is for open. Opens would be to numeric. And similarly we want to do this for all these, all, all the columns. We're going to do this for all four columns. Five columns. Did open clues, low, high, low, high, and also volume. We want change it to everything to number. Okay, Let's see. Now, you can see all of these are changed into float because these are the float numbers. And last one volume is integer because it does not have point, so it has been changed into integer. Now obviously, looking at it won't change it anything, but we're just looking at the types. Now that our datetime and our numeric things are changed, what we can do is we can now try to know what is happening. So firstly, we can just say, we can just check the datetime, datetime range in DataFrame. So deep greens, we'll just get the nutrients. What we can do is we can just say something like the Twins. Let's get that documentation here. What date range does is basically it will return a fixed frequency date-time index. Returns the reigns of equally spaced time points where the difference between any two adjacent point is specified by the given frequency, right? So for example, something like something like that, right? So we'll have all these date-time index rate and then we can use this index to get our date. So let's say I want to get the, okay, let's use this stack overflow for our reference here. So I can just say we did the df dot date, right? So we changed that. So we can now select it with this, this kind of thing. So we have to firstly select, so I'll explain that to you. And this is how we select the different things in Python. So here you can see we can use dot date range and then we can just use that as our index rate. So what I will do is now firstly, I will just use dots. So firstly, what I would see is I would say, um, this man, period or three twinge. Random one. Yeah, this one. So we can just copy this and I'll explain it to you here. So what this is doing is basically it is a selecting df, new df is df, and then we're selecting this. So this is how we conditions of value. So if df Date whenever DFT is greater than 200022226, 0601. So from 0601, we want up to 2022, May 6 be at least 293 and maybe Dr. 29th. Then what I can say is if I say df or I'll just name it different df selected. Then we can just say df selected. And you can see all of these are in the month of June rate because it starts from that and ends up to here. And it should be also equal to because we also need the entry of that and also we need entry of this. So we used up two equal to. And then you can see from June 1st to June last right. Now, what we can do is this is for the June month rate. So we can just say df equals this, and then we can just say df June equals this. So now it's the same thing, right? So what now we can do is another thing that comes to my mind is we could actually find the average of closing price, right? So how many whole was, what was the average of this month for IBM, right? So how I can do that is I can firstly have to, I have to choose that column. So df close is our column width. Then what I want to do is I want to check the mean of it, right? I want to check what is the mean of it. So I can just say not mean. That would give me 281, right? So we can say that the average price of IBM stock this month was 281.48. So every price. And then another thing that comes to my mind is what was the average volume of sales? So what I can do is I can just see, I have to now do the average. Average is obviously the mean itself. So I can say average volume equals df. Now we have to choose volume, in this case, volume dot mean. That would give me a VC volume. So let's see how is ABC volume. So approximately we had 3,598,636,980 volume, right? Daily volume. So this is in every volume daily average price. That is the thing. Now, other things that we could identify here is what was the difference between open-end, sorry, open includes. What was the difference between these? And what we can do that is basically we have to create a new table. We have to create a new column which is opened minus closed, right? And then we can see what percent was that change was. So how we can do that is basically by saying df new one. So we want d equals new corneum equals our old Colosseum, Open minus old. Are you? So if I say that, PDF, if I say that and run the earth, now a new column will be created. You can see it's different. Is how the difference is like. What is the difference between open and close? Like how it has been changed? And this today it was down, so it is minus 2.6. And now we have to use this in a number form rate. If I want to know the percentage of increase and decrease, how I can do that is basically by saying our highest one is open close, so we have to know. So for example, let's say in the close rate in terms of clues, what is the difference? So how I can do that is basically by saying, open bike lose divided multiplied by 100. That is, our difference, isn't it? So if I see here 98 per cent, Sorry, Was it close by, open? Now it's opened minus clues. And then buy clothes. That is the formula. So open minus clothes would be first. And so that's why isolating it inside this isolation and then opened minus clothes and then buy clothes times a 100. So let's do that. So yeah, that is our percentage, so difference, we can just name it as diff per cent and just run that. So we have a difference per cent. And we don't need to. That is because we created that if I were just created from for IBM. Okay, Let's read on this, okay, redone this. Ibm. Run this, run this. Okay, so now we just have difference per cent. So we can see today, IBM shock was increased by 1% when we're in 44 per cent. Yesterday it was like increased, the day before yesterday was decreased. So now we can really see the percentage of increase and decrease rate and how it has been fluctuating. Now we can use this value and plot this into a plot so that we can see how we do that is basically by saying, we have now changed the date into an index. So that's why what we can say is df dot set index. And what do we want to set is decreased. Let's see the date. So date is there, right? So I will just call it df equals this because we want to plot it with the date. So df, we want to plot, what is we want to plot diff per cent rate. So what I can say is DIF, dif per cent per cent dot plot. I can just use that. And then I can see the plot. You can see how it is increased from 202262 and up two onwards rate. This is from, okay. We didn't choose this because this is from all the way from from June, not only for June. So we want to check this for June only. O we want to change it for June. So df June. So we want to see the DF of June and df of June because we don't want other things, right. So here also we want only the df2. We have June. And similarly here also d of June, here also. And then we set index of DFT June itself to date. And let's see. Now we have this. Okay, Now let's set that index to index date. So we have this. Now we can plot this with of June percent rate. Now let's see. It gives us an error. Diff percent is not there. Yeah, we don't have the diff percent because we didn't create it. So let's create that. So run, run, run, run. So we have our div percent now and then run it. So now you can see how it has been increased from 2022, June 1st. It is It went down and then went up a little bit. It has a big dip here, and then it went up again. Right? Now we can have other plots. Also. We can have multiple different kinds of plots. But this is the tentative understanding of this, like how we can do that. So yeah, this is how you visualize the data. Now, we just used our APIs to gaps the data, use our pandas to read that data into a DataFrame. And then we tried to convert it into DataFrame, did a lot of stuff. We changed, convert the datatypes. We made it into a, we calculated some things and then we plotted it, right. I want you to practice this one on your own so that you get a good understanding and good hands-on on it. Because it's a quite in detail thing, right? So you can just pause the video, go back and forth a little bit. And then once you are done, we will see you in the next one. The next chapters will be on a coding interview questions. So we'll be looking at the real-world examples and real world questions, and we'll be solving those. So yeah, I'll see you in the next one. Stay tuned. 41. Final Remarks: All these times and working with me and learning from me. It is my privilege to help you all to get something out of this course. And I'm hoping that you were able to get something out of this course. Like, I would obviously love for your feedback and you know what you think about this course. To my email. Also, if you want to write it down, it's basically COVID at COVID punted.com. So you can want to check it out. And if there is any feedback or anything that you want to give, you can just give it to COVID COVID pantry.com. I'll just write it down here so that it's easier for you. So COVID that COVID plenty.com. I would love for you to hear from you all. And if there is any point of improvement and anything that you think is good for me, then you can just write it out in the e-mail. Otherwise, it was a great time. We're recording this session, helping you out. I hope there were a lot of things covered in this video. I want you to again, go through it again wherever you need. And I am sure that reason that you are already up to here tells me that you are quite passionate for it. So I'm sure that you will be able to get a great hands-on on Python and you will have a great career and great opportunities with Python. So the next step would be now to, now you have this skill set. Right? Now you have these portfolios and now you have these projects that you did. Now what you can do is now you can start doing some freelancing works, starting some gigs online and helping people out. I would encourage you to do some more projects, not just say okay, I've already done it and so that's it for me. I'm encouraging you to do more projects, do more practice sessions, and do more of these things that we did in this episodes and in these classes. And it is the ever-growing process, like learning is always ever-growing. So day-by-day, you will learn again and again and again and again and again and again and again and again, right? So it is like that and it is important for you to understand that. It's not about your number is or it's not about how much you know, it's about how much you practice. Because at last, that comes down to is your efficiency, your passion, your drive to do something. So at last, I would like to congratulate you for coming this far and being able to be a Python developer. Now, if you are able to record up to this now, I'm sure that you will be able to go much more than this. And I wish you all the very best for your upcoming journey, upcoming things that you will do and things that life might get you ahead. And I wish you all the very best. So next steps would be to do some online projects, do some freelancing gigs on Fiverr, on Upwork. You can just do some online gigs. And after that you can apply for jobs. Also, if you want to pursue entrepreneurship, then you can create your own job, your own business with this also, this is a lucrative skill set that you just acquired on the future. In the future. I head, you will have lot of benefit with this, right? So not just say, I'm done with this, I don't want to learn. You'd keep learning, keep practicing ever-growing rate for your life rate, biting is used. It should be like your hobby, like whenever you get for free, you wanna do it great. So make make that mindset in your mind. Apart from that, nothing from my side aisle than sign off from the year are obviously love to hear from you. Covid COVID fancy.com. It was a great privilege. And congratulations for you all for coming this far. Yeah, that's it for me. In this one, if you want to get connected, you can just search for my name, COVID Pantheon, YouTube or something like that. Youtube, I create a lot of videos. So you can see there and also in Google you can see COVID Monday, right? Yeah, that's it for me. I'll see you in the life.