0:08 So today, Haris, try to provide a summary of the things you've worked hard on for the past 40 minutes. You have done a good job, boy. Take the 40 minutes of hard work you’ve put in, summarize it, and then move forward. The summary shouldn't take more than 5 to 10 minutes. Just wrap it up and then get to the practical part. And remember , the concepts explained in those 40 minutes of video. I’m sitting right here; I’m not going anywhere. The concepts that were explained in the 40- minute video. As you start doing them practically, keep providing an explanation along the way. Is it a good approach? It will be a bit much. And stay patient if there's any term you don’t understand. Irfan Sahab and Doctor Sahab, may Allah bless you. Thank you very much. Keep praying, keep praying, keep praying, this is all we need. And when you are praying, I request you all, when a prayer comes
0:55 from your heart, pray not just for the Doctor and Irfan Malik, but for the entire Zaban team. Zaban was made the medium for us to be standing here. I said yesterday, if we were struggling to make ends meet, we would be sitting here listening to a client or lecturing them. We wouldn't be standing here, would we? So, as a company, there is an entire team behind it. No single individual can do all of this alone. I can say that because the gadgets set up here right now, you know , it takes some effort and some money. And this isn't even their job; this is their extra time. Yes, absolutely, this is extra time, sir. This is everyone's extra time, and they were kind enough to support us. Our office closes at 7:00, right? The
1:40 office shuts at 7:00, and now it's 8:00 , and they are all still here, waiting. Once the session ends, everything has to be packed up, and then our editor will edit it all, and the poor guy will be working on it in the morning. The social media team is putting in their own hard work. So, if we finish the lecture at 9:00, it often turns into 12:00. Let's start, sir. 700 people will build up. We welcome you with a round of applause. The one and only, Mr. Haris. Mohammad Haris. Just kidding. Just kidding. That was a bit too much. I was just saying, Haris bhai, come on, son. We uploaded a Python video on YouTube today so that we can speed up the lecture we need to deliver today and achieve our next goals in a timely manner. Because we
2:29 have an audience connected with us whose basics we also need to cover, we need to keep them along with us. So for those who have watched that video, well and good; and for those who haven't, we will now give them a preview and try to make it a quick preview, but one where you can understand all the things covered. And you must keep in mind that today’s quiz will be based on the topic we are explaining, and today's quiz will be a bit technical. Why? Because our work is becoming technical now. So if you keep your attention focused, you will perform well on the quiz and your understanding will also develop well.
3:15 Welcome, Sir Haris. Haris bhai, teach like you. Haris bhai, you are moving towards me. Mashallah. Wow, brother, wow. Haris, I am jealous now. So let's get started. In yesterday's lecture, when we started talking about variables in Python, we taught you a data type called string. So today, we will take strings a little further. The reason for explaining strings in extra detail is that we need to have you use a very important tool, ChatGPT, later on. Okay? And when we use ChatGPT, you will basically have to deal with strings within it. And when you learn how to manipulate strings, modify them, and understand them well
4:01 in advance, it will be much easier for you later. So, I told you in the last lecture that Python gives us a basic print function, through which we can display any message we want. So, I provided a string inside the print function, and you must keep in mind that when you provide a string, you must enclose it in double quotes or single quotes. Otherwise, it will not be considered a string. It will consider it as a variable, and it will generate an error saying that you haven't defined this variable for me. There is no value inside it. So where is this coming from? Here is an example
4:47 where I have used double quotes in the top line, the first line. In the second line, I have used single quotes. And if I execute this. Right? Then the message that gets displayed to me will be the same message. So, it's your choice whether you use double quotes or single quotes, but you must use them. Right? Otherwise, an error will occur. And this is just like the last lecture, where you can assign that same string to a variable and pass that variable to the print function, and it will work the same way. Right? That message was displayed to you. Now, your message can be anything. That was your string for a single line. But when you work with GPT
5:35 and others, they will generate entire paragraphs for you. You will have to handle that. That is called a multi-line string. Right? So, to handle a multi-line string, what you do is, for a normal one, you were using double quotes once. But here, you have to use triple quotation marks. Right? Use triple quotes to pass a string in multiple lines. Otherwise, it will not consider it as multiple lines. If I remove this from here. Right? I have removed these quotes. Now it has highlighted it. It has started generating an error. So, you people need to look at this very carefully. I
6:21 will execute this. And I have passed the same entire multi-line string into a variable in the same way, and I gave that variable to the print function, and it is displaying our entire string exactly as it was. After this, Python gives us some built-in functions. Right ? For those students who are confused by the name "built-in function," let me explain. A function is something that performs a task for us. We give it something, and it performs an action on it and gives us the result. Like a juicer machine. What is the job of a juicer machine? To give you juice. You put the fruit of your choice into it
7:07 and press the button. At the end, what do you get as a result? A juice of the fruit you put in. In the same way, Python gives us built-in, ready-made functions. All you have to do is? According to your use case, you have to pick the function that solves the specific problem you are working on. Then apply it to it. Okay? Now the first function you have is uppercase. What is uppercase? The alphabets you have, or the string you have written, has two cases. Either it will be written in small letters, which we call lowercase, or it will be written in uppercase, which we call capital letters. For instance, if your problem is that you need to convert all the text, the entire string, into lowercase
7:54 . Sorry, I am explaining upper now, so convert it to upper. So what will you do? You took a string. Assigned it to a variable. Okay? Now what you did is, I put the string in variable 'a'. Apply the upper function to that variable 'a' . So dot upper, apply the upper function on variable 'a', a dot upper. That much is clear. Now I put it inside print. Why? So that the output it produces is also displayed to me right there. So let's execute this. So now the input string I had was not all capitalized. But the output I am getting is all in capital letters. It
8:40 is in uppercase. Similarly, its reverse case is for lowercase. So now if you have a string and you want to convert it to lowercase . Then the variable in which you have passed it, use that variable name dot lower, and pass that to the print function, and its result will appear in front of you as soon as you execute the cell. Now your next function is for white spaces. What are white spaces? Basically, you will be receiving a string. Sometimes the string is quite massive. It contains white spaces. Uh, when will white spaces basically help you? Before the inverted code. Okay? A
9:26 space appeared here, meaning there is a space before hello as well. There is a space after hello as well. Uh here, sorry, I did it here. So now when I The function they have provided for this is strip; when I apply this, the output I will get after applying it is that those spaces, the extra spaces, okay? They will be removed. Okay? Now, the output you see might confuse many users , as it looks like the same string is appearing below. For their convenience, I have perhaps mentioned in the comments that the actual output is without spaces, within inverted commas. I have mentioned this here in the
10:13 comments. Okay? Next comes the replace string. Sometimes there are repetitive words in your string that you want to replace with another word. Okay? If you want to replace anything, like saying replace 'H' with 'T', or replace all commas with slashes or question marks. So, what do you need to do? The same variable in which you stored or assigned your string, you need to apply the replace function to it. Now, you can see something here: the brackets of this function, these round brackets that we call parentheses. I have provided two values inside them. Two
10:58 strings have been provided. But that wasn't the case anywhere above. So, there are some functions whose purpose is such that you just have to press the button, call the function, and it will do the work itself. But for functions where you want things your way, like " replace this with that," you have to tell it, "wherever there is an 'h', give me this instead." These are called function parameters. Okay? If you don't provide these parameters, it will give you an error. Why? Because it has been told that the user will tell you. "I want this in place of that." So if you don't specify, an error will occur. So,
11:46 the string we gave, it changed "Hello World" to "Yello World". Next comes the split string function. The split string function is basically, when you go further into the NLP domain, all the models are trained using data that is prepared exactly by splitting it into tokens like this. So, a token, as I told you before, is a simple word; a single word is considered a token. So, if you want to convert an entire string into tokens, Python provides you with a function to convert them into tokens: the split function. Okay? You also need to provide parameters inside it, specifying how you want to split or
12:32 separate them. I have provided a comma here. So, the output you get will be comma-separated. Right? Similarly, if you want to provide anything else, it will replace it with that. Right? It will separate them with that. So, all the functions I have told you about. Now, you have to keep in mind that this is not all the functionality. These are not all the functions that Python offers us. We have intentionally included fewer functions. There are two reasons for this. One reason is that we have a time limitation. We have to cover other topics within this time. The second thing is that you have to go and explore the remaining functions on the internet yourself. Why? If we lead you straight to your house, you won't
13:17 look here or there; you shouldn't look to the right or to the left. That's why it is better that you explore the path and direction we are giving you yourself, seeing how things can be done this way or that way, and explore all the possibilities. Along with this, a task is given below. I have kept the task very simple, keeping my audience in mind, so those who are facing issues can handle it; we have mentioned all the functions I told you about above down below. We have created a small task for each of them for you. You can easily do it. Moving on. The things you have learned so far are that one variable holds one value, right? You
14:02 store it in one variable. Right? Now, programming is the kind of thing where you encounter multiple types of problems. Let's say you have a problem where you need to store many values in a single variable. Right? So, what will you do then? To solve this problem, Python provides us with different structures. So the problem is that we need to store multiple values in one variable. To overcome this problem, Python provides us with different structures. As you can see written on the screen, a list. Right? Python provides us with other such structures as well. List, tuple, dictionary, set.
14:47 Right? Now, each one has a different use. It has different functionalities. We will discuss them one by one. But I will spend a little more time on the first list. Okay? I will cover the others quickly because most of their functionalities are different. There is a difference somewhere. Okay? So, you need to listen carefully to the first one. You will easily cover the others, God willing. So, what is a list? Lists are primarily represented by square brackets; if you want to create a list, you use the variable name equals an empty square bracket, and that will create an empty list. Now, what have I done? I have created a list in front of you that contains three strings. Okay?
15:32 Three strings are written. Apple, banana, cherry, and they are comma-separated. Okay? This lets it know that these are three different entities. If I remove even one comma, I will get a syntax error here. Now, these three strings have been stored in the variable 'thislist'. And I passed this variable to the print function, and the print function displayed the list that was stored inside it. Now, the values I am storing inside the list , which you see in front of you, what are they called? They are called items. Items of the list. Since these are strings, what would you call them? A list of strings. A list of strings. If
16:19 I wrote integers instead, gave number values, or provided float values with decimal points, the name would change accordingly. A list of integers. Okay? Similarly, one of its properties is that list items are ordered. They have a specific order. What is meant by order? This list is written in front of you. First comes apple. Then comes banana. Then comes cherry. Wait, apple, then cherry. Apple is first. So, Apple's position—the index we use in the Python language—is called the index. In simple words, if I ask, what is Apple's position? Zero. Normally,
17:06 what do we say? We start counting from one. 1, 2, 3, but in programming languages, our index starts from zero. So, Apple's position becomes zero. Its index will be zero. Banana's index will be one. And so on, it will continue like this. So, that was about the order . Then it is changeable. You can change it. Once you have created a list, you can change the values inside it. You can edit and replace banana with something else. And allow duplicate values. It allows you to have duplicates. Just like you see apple appearing twice and cherry appearing twice. Right? So, inside this, I printed it, and the list was printed in front of you just like that. Next,
17:53 Python provides you with a built-in function so that you can also get the count of all the items and values stored in your list. For instance, your list is small right now. Sometimes, very large lists appear. Now you cannot sit and count them manually. So, when you cannot count them manually, you use this built-in length function. Now, I simply passed the variable that already stored my list into the length function and printed it, and after printing, it gave me that there are five items in your list. Okay. After that, you have
18:40 the option in a list to choose which data type you want to store, whether it is string, integer, float, or boolean. It is your choice. The same data type can be in a list. Different data types can also be in the same list. I would like to explain one thing here. Haris has been talking about built-in functions repeatedly. Right? Now you are calling them Python built-in functions, and remember that we will study libraries in Python, include them , and more methods will come within them. So, you can explain built-in functions for people who might not understand, like if you have a child at home, a student, or an employee, and
19:26 you have already explained everything to them that if I give you this instruction, you have to do all these tasks and bring them to me. So, you just have to give them one instruction. They do all the work and bring it back. You have stored a lot of such things in their mind. You have trained them. Every programming language has these kinds of things that the developers created to make your life easier by bundling many instructions together into a single unit, which we call a function, and they come built-in with programming languages. When you are using them, we are actually loading many of their libraries in the background. So you call their predefined functions. And if you feel that you are going to do something that these functions won't do as is. If you
20:12 need to change them slightly, you can also customize those functions. There is a specific term for that which we will discuss later on. So, these functions—in my opinion, one of the reasons why Python or any programming language is strong is because of the predefined functions they have, how much they simplify our lives, and how numerous or effective they are. Right? What if we had to write everything ourselves in a programming language? For example, in assembly language or when we talked about C ++, we mostly had to do everything ourselves. As languages evolve, they are pre-writing things to make your work easier, and you are just reusing them. In most cases, like 'count'. The 'count' went into the array itself, searched the list, counted the items, and gave you
20:59 the count. So basically, methods and functions—I am using these terms interchangeably. They are made to make your life easier. Sorry to interrupt you, brother. You are back on. So, I was telling you that inside a list, you can keep the same type of data, and you can also put different data types in the same list. Just like the list in front of you, which contains string values, integers, booleans, and if you add a float, it will also work, and the result is being displayed below. After this, comes tuples. Now, their concept is almost, just about the same. Right? But with a few differences. Right? What is a tuple
21:45 ? If you want to store multiple values in a single variable. A tuple will do that same job for you. Right? After that, it is ordered. The list was also ordered. Right? The first value of the list also has an index of zero. The second value has one. The same case applies here. But where does the change come in? The change is that it is unchangeable. This is what is called immutable in programming languages. All right? You cannot change it. All right? And the difference is that for lists, you use square brackets. Inside this, you have to use these round brackets, which we call parentheses. All right? This helps Python identify that it is
22:31 no longer a list. Now it is a tuple. Its usage is exactly the same. You created it. You gave the values that you wanted to provide inside it. You assigned it to a variable. You gave it to the print function, and it appeared in front of you. The elements inside them, the values you store, are called items. Regarding their items being ordered, I have already mentioned that. They are unchangeable. All right? And they also allow duplicate values. So, what is the major difference between a list and your tuple? Yes, in a list, you can change values, but in a tuple, you cannot change values. So, I am
23:20 leaving it up to you to explore this yourself. I have explained it to you with this major difference. Actually, I'll share an interesting fact with you ; for instance, you create a tuple. But you created a tuple here, where my cursor is highlighting, as I am doing right now. You gave your string value in inverted quotes, or for example, you could have given an integer value here too. All right? And you thought that since you added round brackets, it would automatically consider it a tuple . But that is not the case. Why? The tuple will take it as a string. To keep a single element in a tuple, to create
24:07 a single-element tuple, you must add a comma with it so it knows that a tuple has been created and it currently contains only one element. Other elements might be added later. All right? So, I printed its type to check so that I could show you the data type. Type means what the data type is. The first one is a tuple where we added a comma, but the second one is not a tuple. What is it? It is a string. All right? Okay? It is the same case as in lists, keep the same type in one tuple. Keep different types. No problem. Now let's move on to Python sets. Most of you must have heard the word sets, as
24:54 they are used extensively in mathematics as well. Okay? So, what are sets? Sets also address the same problem for you. Which one? You can store multiple values in a single variable. And now there will be some differences in their properties. Are sets unordered? What is meant by unordered? Now let me explain to you that when we need to create a set, we use curly brackets. For lists, there were square brackets. For tuples, there were parentheses. Round brackets, and for sets, you will use curly brackets. Now, you placed your items inside them in the same way. Okay? But the thing
25:40 about being unordered that I am going to tell you is that I have written apple first. Second, I have written banana. And third, I have written cherry. Listen. But when I execute this , every time I use it, their order will change. Why? Because it has not assigned them any position. Okay? So when no position is assigned to them, they become unordered. And when they become unordered, what do they automatically become? They become unindexed. They don't have an index. No position. And they are unchangeable. Okay? You cannot change them; once you have put values inside, you cannot alter them. But one thing can be done: you can delete the value you want to change and
26:28 add a new one in its place. Okay? So, it does not allow duplication. Here is an example: students might say, "Sir, you said it doesn't allow duplication, but you have created a set in front of us and apple is appearing twice in it." At the first position and also at the last position. But when I execute this and show it to you, notice that during execution, it gave me apple only once. Okay? Why? It considers same values, same items as just one. Even if you write it 10 times, when it uses it in the program, it will consider it as just one value. Similarly, if you want to find its length as well. You have the length function. You can use it.
27:13 And the point about data types is also valid for this, just like it was for lists and tuples. And now I am introducing you to a built-in function called type. Why? You have already seen many things that have different types. So now you will need this function to know the type of what you are creating. To find out the type, you simply need to use Python's built-in type function. Now, what is the procedure for using type? The list, tuple, or set you created. You simply passed it into that type function. And printed it out. Now it is telling you that this is a set. Okay? Moving on. Let's move ahead. Next
28:02 , you have dictionaries. Python dictionaries. I will give you an example of a person. A security guard. He has keys to 100 rooms. And those keys look exactly the same. Okay? Now he has two options. The first option is that when he goes to lock every door, he tries each key one by one. It's possible the first key works. It's possible the 100th key is the one that fits. Okay? What is the second option? He assigns a label to each of those keys so that as soon as he goes to room number one, he sees the title he marked or attached to the key for room number
28:47 one, grabs it, and opens the lock. Okay ? Similarly, Python provides you a facility that if you want to store a value, okay? Attach a key to it, what you do is attach a key, put a mark so that whenever you need that value, you just provide the mark, the name, and Python will bring that thing to you. Okay? So let's read some properties of dictionaries; dictionaries are used to store data values, you can store multiple values. In the form of key-value, a key will be given. Along with it, its corresponding attached value will be given. Whenever you give that key asking for that thing, its value will come up. I have already
29:34 created a dictionary for you beforehand . So, first, a dictionary is a collection which is ordered. It is ordered, changeable, and it does not allow duplicates. Now, some of you might get a bit confused here, thinking you have to remember things for lists, tuples, sets, and dictionaries all at once. For that, I have added something very simple later in this notebook that will help you remember and recall everything in two minutes or even less. Also, let me explain that if you aren't understanding some concepts here, it's impossible to be learning a programming language or anything technical and grasp everything perfectly as you go.
30:23 That is not possible in any way. So, learn how to learn. I'm interrupting briefly after reading the comments. Learn how to learn. Let me give you a tip while I'm at it, in case you noticed they used the word 'tuple'. If you don't understand it, just write down 'tuple' and add a comment to your notebook. After the session, you'll have a word that you need to research. Okay? What is this? You will hear it from different instructors. Harris and I told you today that you need to study tuples, which is enough guidance for us to provide. You will learn, and the whole internet is open to you, so it doesn't mean that if you don't understand one concept, you should get stuck on it, wondering, 'What is a tuple, what is a tuple?' Four more
31:09 things will pass you by in the meantime , and you'll understand them, and then a complete sequence will form. It's okay if the screen is blurry, it's okay . Let me remind you all that we have high-quality cameras installed; if you check our YouTube playlist, you will see high-quality videos there with better sound quality, which we extract and merge later, so you'll find them. Now, this doesn't mean you should go there right now, because I am looking at your questions. If you stay connected with us, it makes it easier for me to hear and understand your questions, and you have no idea how we are updating the lecture accordingly as we go. So, with patience, composure, and a notebook, keep your focus maintained and move forward. I interrupted you. Sorry, keep going.
31:56 Keep going at a slightly slower pace. Okay. So, I showed you that we created a dictionary. While creating a dictionary, you have to keep in mind that its structure is a bit complex. I will simplify it a little so that you can understand it better. Otherwise, some of our students might get confused , and it is not our purpose at all to confuse them. So, I have brought it into single lines now, so you will understand quickly that when I have to create a dictionary, I use curly brackets. Remember that we were using curly brackets for sets as well. But where does the difference arise? The
32:41 difference arises here: when we provide a key, we also assign a value separated by a colon. Okay? So, how are a key and its value separated from each other? By a colon. And how are two key-value pairs separated from each other? By a comma. The comma between them separates the two key-value pairs. So, for example, I wrote "brand". Then I gave the value "Ford", I wrote "model", gave the value "Mustang", and I wrote "year" and gave the value "1964". First of all , I will print the dictionary to see if it is printing correctly. Okay? The same concept from before applies here;
33:27 the values inside are called dictionary items. They are called items, but the first value is the key and the second is the value. Okay? So, you have to keep this in mind. Now, what I do is, for example, I give it a key to get that specific value. So, the dictionary created above is right here in front of you. Inside the print function, I said: take this dictionary created above and pass the key in square brackets; since the key was a string, I passed it accordingly. When I executed it, you can see the output "Ford" below. Okay?
34:12 "Ford", because that was the value corresponding to that key. I have already explained the concept of ordered and unordered. If some students don't understand, they can read it from here as well. I have also already explained the changeable aspect. You can read it from here. Now, duplicates are not allowed in a dictionary. So now , what if you provide duplicate values? I mean, what duplicate values? You provide duplicate keys. Right? So what will it do? I provided a duplicate key for the year in this. First it was 1964 and I added 2020 as well. So what happened is that it overwrote the previous value. It put the new value in its place. Right? Now, a table is provided to you all, within which the differences between lists, tuples, dictionaries, and sets are present
34:58 right there in the notebook. After doing all these things, if you are feeling confused, just look at this table and your confusion will go away. Along with that, if you don't want to read the text at all, there is a small table in which all their features are mentioned; look at them and refresh your concept. Okay, so those were all the video concepts that we uploaded today. Now, all the concepts from here onwards are new for everyone. So everyone should now continue with this and follow along carefully. Now Now,
35:45 suppose you are solving a problem and while solving it, you reach a situation where you have to make two decisions. That if it rains, right? Then I will not go to the office. Right? And if it doesn't rain, then I will go. Right? Now you have to put this into the program. You have to tell the program you are writing that, "Hey, if this happens, then you have to do this, and if it doesn't happen, then you have to do that for me." For that, Python provides us with if-else statements. Right? So now There are quite a few things written in front of you inside this. I will explain them to you one by
36:31 one so it will be easier for the audience to understand. What does the if statement do? The if statement simply helps you make decisions within the program. What syntax do you have to follow for if? If, right? Then you have to specify the condition that you want to fulfill. Right? Or based on which you have to make a decision. Right? So you will provide that condition. After the condition, following the syntax, you have to add a colon. You have to add a colon. And after the colon, you have to provide the task that needs to be performed based on that condition. You have to tell it, "
37:17 Sir, do this." That could be anything. Whether you need to assign a value, generate something, or print it. That is up to you. So, I will give you an example where I created these two variables. I assigned the value 33 to ' a', 200 to 'b', and what did I say? If 'b' is greater than 'a', if the value of 'b' is greater than what? Than 'a'. Then what should be done? Come down. In the print statement, it says: "B is greater than A." Right? So now, if B is greater than A, this statement below will execute, and if it is smaller, it will not. So, I'll simply change the
38:05 value of 'a', and now since B is no longer greater than A, my message stops displaying, which shows that an if statement helps you in decision-making. Now, keep this in your mind. Some people might have noticed this, while others might not have, that the print statement I wrote is not directly under the 'if'; I wrote it a bit further ahead. Why did I do that? See, you have to tell the 'if' statement that after this condition, you have to perform this task for me. Right? So, how will
38:51 it know up to what point you are telling it to perform that task? Because of this decision, because of this condition, I have to perform this specific task. But how will the language know how far you've told it to perform the task? So, the extent to which you indent it is called indentation. I pressed backspace, and the print came right next to it, and it underlined it, signaling that your spacing is wrong. The indentation is incorrect. So, I pressed tab, it went back to its actual position, and it's fine. So, I have explained the indentation concept below, and its example is mentioned as well. Right? Below that, it is giving you an error,
39:38 saying "expected an indented block," meaning it needed the portion below to be indented. You haven't aligned it properly. Okay? The next thing is 'elif '. Right? Of elif. You can simply say that elif means you gave a statement, a condition. You told it that if this is correct, then do this task. Okay? But you want to give another condition: if the one above is wrong, then what should I do? So what you do is give an elif. What happens in elif? It will look at the condition above. Okay? It is not correct. So it skipped the task it was supposed to execute and came to the elif condition. Now it will check
40:26 that. Okay? Why? The one above was incorrect. So I took two variables. I assigned the same value to both of them . And I gave the condition if b is > a, okay? I put a colon after it. You must not forget to follow the syntax. After that, I indented the task I want it to perform. Print statement. I said, sir, if b is greater than a, then print b > a. Otherwise, what should it do? Come to elif, check if a is equal equal to b ; well, I put two equals here. Okay? If I go up a little, I have mentioned these things that if you want to compare two things, you have different
41:13 choices to compare. What? It is possible the first is greater than the second. It is possible the first is smaller than the second. It is possible both are equal. Or you can say it like this: you are looking at two things and checking if both of them are the same. Meaning, one condition is: are they the same? What is the second one? Are they not the same? So the first one will check if they are both equal. Is equal to. The second will check if they are not equal. Not equal, and the first is less than the second; then you have less than equal to. You can also do it this way, that either the first value is smaller or equal to the second, if
41:58 one of the two conditions is met. Okay, I will add one thing here. These operators that Haris was talking about are called relational operators. Exactly. Now, this "relational" comes from "relationship." Like, in a house, if parents have four children, one will be the eldest, one smaller than that, and one smaller than that. So, the relationship between them is that the younger brother is the youngest, and the older one is the oldest. There are two in the middle. So, that is the relationship. Now, in the same way, there are two variables. We have put the same thing in both variables. So, both variables will be equal. Meaning, what is the relationship? The equality relationship is shown by the double equal sign, which tells us that the
42:46 values between the two variables are exactly equal, meaning the relationship is one of equality. And if, for example , I have a variable 'a' and I put 2 in it, I passed 2. I have another variable 'b' in which I passed 2. Now, what is the value in both variables? Two. So, if I check whether there is an equality relationship between both variables or not? Then what will the answer be? Yes, both have 2, so both variables are equal. Okay? So now, suppose there was a 2 in 'a' but a 3 came into 'b'. So now, is it equality or inequality? It
43:32 is inequality. We represent inequality with a 'not equal to' sign; this sign is called an exclamation mark. If you press shift and 1 on your keyboard, this exclamation sign will appear. Okay ? We also tell you the location of the signs so that you don't have trouble finding them on the keyboard. The sign I am talking about, the exclamation sign, is on your keyboard above the 1, 2, 3, 4, 5 keys, it's above the 1 key. When you press shift with 1, this sign appears. It is called an exclamation sign. So in Python, if we want to check
44:17 that two things are not equal, we say A exclamation equals B, which means A is not equal to B, so this is the inequality relationship. Okay? Actually , it's not "un-equal", it's "inequal", just like it's "incomplete", not " uncomplete". Okay, so after that, we also have greater than/less than relationships, which we call greater than, then we have the greater than or equal to relationship. Then we have the less than relationship. Then we have the less than or equal to relationship. So, all these operators are collectively called relational operators in the Python language. And
45:04 whenever you use if-else, you deal with relational operators a lot. Okay? Mostly, when we use if-else, we use relational operators. And when an if statement evaluates a relationship. Now , "evaluate" is a difficult word. It means I said A. Put the equals sign, B. Now Python will look at it, seeing that A was two. B was three. I look at the values in A and B and match them, so in simple terms, we call this evaluating.
45:50 Meaning, the expression I wrote, a == b , or that relationship, Python will solve it and bring the result. So, the result of these relational operators is always in boolean. Either it will come out true or it will come out false. You might remember that in the last lecture , we introduced that boolean can only have two values. Yes or no. In Python's language, we call that yes or no as true or false. If we say if a equals equals b, and both a and b are true, then what will the answer be? True. A boolean answer. But if I put
46:37 three in b and I say a equals equals b, then what will the answer be? False. So , if the result in the if statement is true, the if statement will execute. But if the result of that relationship is false, then the elif statement will execute. So, I thought it was appropriate since Haris bhai has been talking for a long time. Let's give him a little rest. Let him catch his breath . So now, over to Haris bhai. Thank you . So, we have covered up to the elif statement. Now let's move forward from here. Just the else. Right? The else statement. Now, what you do is that You
47:25 gave a condition, it became false. You added an elif. You gave a second condition. If the first isn't met, then check this. Right? But now you say that both have become false. So you say, okay, if this didn't happen and this didn't happen, then do this. Now you don't make it check anything else, that you still need to check and then do this. No, you gave the first condition, if it's wrong. Elif, if that's wrong. Then check this. If this is also wrong, then what to do? Else. Just go ahead and do this. Right? Like a teacher asks , "Sir, did you do your math work? Your homework?" No. Yes, that was for science, otherwise, go ahead and become a rooster now. Okay? So that is how I explain 'else' in simple terms; I had
48:11 an example in mind and I said I shouldn't miss this. So, now for the ' else' statement, it continues with the same code as before, but I have added ' else' to it. Is B greater than A? Okay? Since B is currently less than A, the first condition will be false, the first message won't display, and now it will move to 'elif'. At 'elif', it will compare both to see if the values of a and b are equal. They are the same, but they are not equal. So what will it do? This condition and the print statement associated with it will also not be printed. What will it do? It will move to 'else'. Now it will perform whatever task you have assigned to 'else'. So, what have you given it? Print. Print it . Why did you say A is greater than B?
48:57 You checked; check B first. Is B not greater? B was not greater either. Is B equal? B was not equal either. So what does that mean? A must be greater. Print it. Alright. After this, just as the sir explained, you have relational operators. In the same way, you have logical operators. I will help some students remember it this way: in 9th or 10th grade, students study gates. Logical gates. Okay? So, similarly, in Python, we also have logical operators. And the funny thing is, their names are kept exactly the same. You have three types of logical operators. And, Or, Not. Let's look at 'and' and 'or' first
49:43 . What does 'and' mean? 'And' means when you want to make a decision that involves two things. Okay? Two decisions. One, two conditions. Sorry, one and the second one. You say that the first condition must be met and the second one must also be met. For example. You say you want to travel, and while traveling, you set two conditions. You tell the person making your reservation that the ticket should be for Tuesday and let's say it should be with PIA. If a ticket is available on PIA and it is available on Tuesday, then book the ticket. Alright? Now what
50:30 did you do? You put a check on both conditions so that both must be correct . So, the task you have assigned will be completed. For this, you use 'and'. Check for PIA and what else? Tuesday should also be there. Follow both conditions. Alright? Now let's move on to the 'or' condition. The 'or' condition means if you place 'or' between the two conditions you gave, it will look at the first condition and the second condition. If the first one is fulfilled. If the first one is true, the message will still be displayed. If the second one is true, it will still be displayed. There is only one case where the message won't be displayed. And that is the case when both conditions are false. And let's execute
51:18 this in front of you. So, at least one of the conditions is true. And in this, there is also a case that even if both conditions are true, it will still work . Next is the 'not' operator. The 'not' operator basically just checks if your condition is, well, it checks the reverse of it. For example, A has a value of 33. B has a value of 200. So you do 'if', and then you add 'not'. And then you've given a > b, checking if a is not greater than b, you added ' not', okay. So now, when you execute
52:04 this, the message is displayed that a is not greater than b, okay. If it wasn't greater, sorry, I mixed it up a little, so... No problem, I'll explain it simply; see , I said that whenever you evaluate relational operators, you will get either true or false. Nothing else can come out of it. Now suppose you did a = b. a had two, b also had two. What was the answer? True. You added 'not' to it , so it turned from true to false. The special thing about 'not' is that whatever boolean result you had, it
52:50 will switch. It will flip. Alright? This is a very simple matter. Now similarly, you had to evaluate a equals equals b. a had two. b had three. What was the result? False. Why? Because a has two, b has three. a is not equal to b, right? a equal to equal to B will be false. But if I add a "not" before it, what will it become? If I add "not" in front of false, what will it become? True, it will flip. Okay? So whatever boolean result comes from a relational operator, "not" will flip it. Very simple. Thank you, Doctor. So I think we'll end
53:38 today's lecture here, and now your job is to take the concepts and topics we delivered today—we tried our best on our end to tell you as much about Python as possible. The rest is for you to explore on your own. You need to practice them, and the notebook related to this will also be shared with you. Now you have time until the next class. You must utilize that time to practice this notebook. After this notebook, explore the things you don't understand on the internet, and find more built-in functions besides the ones we told you about, so that in our next lecture, you are aware of even more new built-in
54:24 functions. Tell us in the comments that you have explored this new function. That you found something new, and try it out with conditions. Do different experiments with them so that you learn about many more things. So the notebook will be shared with you, and by next week, there will be some tasks shared with you as well. And you have to submit those to us. You will be given a Google Form. Just like it was for the first assignment. Now you upload your assignment file there. We will evaluate it later, and your results will be sent to you. So sir, I think it's time for the quiz. Let's conduct the quiz then. Absolutely, I think it is time for the quiz. So we request Waqas Bhai to make
55:12 the quiz live. So Haris, would you like to tell me what you did today? I'm sorry guys, I went out for 10 minutes. Not out, I was sitting in the adjacent studio. I was giving an interview. You weren't giving it. I was giving it. So you tell me. So today, we basically taught students about strings because when they use ChatGPT, the response within it is entirely string-based. So we gave them the concept of strings, explained multiline strings, and showed them how to use different built-in functions so they can manipulate those strings. According to one thing, let me explain something to all you students. Just sharing my own experience because I still consider myself the most incompetent, but since another person
55:58 more incompetent than me joined this company, now I say I'm at number two. So because I was very incompetent, I had a way of learning; I will share that method with you all. This isn't a final rule that everyone must learn things the same way. When I didn't know any programming language at all and would pick up any article to read, I wouldn't understand these tuples, your data sets, and many other things. Pointers took up half my life. Okay? You will be taught pointers soon. You will find out when you are taught. Pointers took up half my life. I just couldn't understand them. Anyway, never mind. But what did I used to do? I used to break down the information. I broke down the information in such a way that while listening to every lecture, I would take notes, and then let's say I had to study tuples. If I had to
56:44 understand tuples, my focus would be only on tuples. I wouldn't get distracted at that time, and I went to understand from many different people. Now, who were those many people? Those many people were YouTube. Because I didn't even have any accounts on social media. There was no mentor. There was no snake-oil salesman. I wasn't paying anyone money. There was no private university. As for YouTube, people have explained things very well on YouTube. So I cleared every concept one by one, piece by piece. Then what happens is that some concepts won't be clear to you. No matter who in the world explains them to you. I am repeating this. Until you actually use them. Let me show you a very complex tool. Give me that box. Okay? So if I say, "Hey,
57:32 what is this?" I give you an explanation that charging happens from here. Its decibel is controlled from here. Its frequency is controlled from here. There are mics inside it. I will give you information about this tool. It will be vague. But what will happen? You will buy this tool. You will use it . The audio will be bad. You will look for it and fix it. You will charge it. When you use it by making mistakes, its concept will develop in your mind. But mostly, while I am explaining it, people will leave it, saying it’s not for me. It has nothing to do with me. It won't work out like that. And that is where people fall behind in life.
58:18 That is why I say you need patience to learn anything in life. Whether it's entrepreneurship, any kind of learning, or a degree, you need patience; you need patience. If you run away after seeing a small difficulty, do you know why most people run away? Seeing that small difficulty, sir, reminds me of Dulani Sahab’s words. May Allah grant him paradise. There are just four, five , six, or seven of his points that keep revolving in my life. He says, "Defeat the person inside you because the person inside you gives you the most lies and excuses." You should learn how to give him a shut-up call. The whole world cannot ruin you. You will keep cruising on your path. The person inside says not to pray Fajr in the
59:03 morning. It is very cold today. I slept late today. I didn’t get sleep last night. My neck hurts. I cannot wake up in the morning. This is the person inside. Right? The person inside says, "What is left in college or university? " The person inside says, "Forget the live lecture, I’ll watch the recording." Right? The person inside says, "What will I do by learning Python?""What have they achieved?""What we are doing.""They are also standing here." Right? This is the person inside who distracts you from everything. All the noise in the world is less. There is more noise inside your brain. There isn't that much noise in the world. By noise, I don't mean loud shouting. By noise, I mean clutter, lack of discipline, you know, messy situations. Many things that you don't want come your way, so you call it noise in a
59:49 different word. In data science, the data that is not useful to us, the bad data, the dirty data that is corrupting our data, we call it noise. Right? So, in the same way, there is a lot of noise in life, but it exists inside your mind. If you control it through meditation, you can stay cool and calm while learning. You can move toward your destination. So, the summary is done after the quiz. What's the agenda for the next lecture? We were supposed to try and get to APIs today as well. But we couldn't. Now, I am telling you in advance that you have to watch a previously recorded lecture. We are adding another recorded lecture in between, tomorrow or the day after. Okay? In that, we will take you a bit further so that when we have our next live session, we won't be explaining things to you like children. Now, we
1:00:38 will open our program and show you Jin. Those who have seen this Jupiter, when they see it, they will wonder why it came. The genie is out. Okay? But Haris will explain it. Dr. Sahib will explain it. Okay? Since he has written that Jin , he will teach you to add APIs so that those who want to do something in programming can move in that direction. We will perhaps try to do our first ChatGPT API. I hope I am not over-committing here if we add a lecture in between. We will try, brother, we will try. I haven't received that kind of response from here. But in the next lecture, I will hit a ChatGPT API and show you the response in Swagger. Dr. Sahib will do this. Otherwise, we will start directly
1:01:24 with Swagger. I didn't understand that Swagger part. I will explain Swagger, man; when I come to the lecture, I will explain it. You were just joking, that's what you were doing. But I will explain Swagger to you. What is Swagger, man? Swagger is a Postman. Swagger is a Postman. We will explain the rest to you later. Postman is a software. Okay? Swagger is, you know, kind of a Postman. We will give it a letter. It will do its job and deliver it to you. The response is that it will take your message. It will communicate and bring a message back to you. It is a software. We put the API inputs into it. The API does its job and gives you the output, which you cannot use in the real world. I will give you another example of Swagger. A bulb in your house went bad. You want to fix the bulb. So, if the bulb on the fourth
1:02:10 floor is bad, you won't go and install it there to check it. You will check it by plugging the bulb into your board. Okay. The bulb lights up in a testing environment. Alright? Go ahead and set it up. Alright? Swagger also does the same job of checking whether the API is working correctly or not. So we have software that we show before putting it into the program. Man, you guys are hopeless, do you get it now? A little. Son, you will receive an email from HR. You will have to move me from Senior Software Engineer to Junior Intern. Just kidding. So thank you very much for joining today, all of you.