Struggling to understand data structures in Python? Let’s simplify it. In this post, I break down the basics of Python data structures in a clear and beginner-friendly way—so you can actually understand how they work and when to use them. Whether you're just starting out or revising the fundamentals, this guide will help you build a strong foundation. #Python #DataStructures #Programming #Coding #LearnPython #TechEducation
Transcript
We're going to learn about data types and its structures. For example, we have 4 kind of data types and structures mainly important for our, you know, like financial market. For example, if you are learning into Python as a new, if you want to step into Quan finance or if you want to step into finance, learn the topic which is really required for us. No need to learn everything and make yourself confused. That's the main purpose. I just taken a fourth thing. These four thing as a data types and structures we are just going to use in a lot of place. OK so in that we have nearly 4 which is nothing but we are going to use integers, we are going to use float, we are going to use booleans and we are going to use string. So this four thing we will be using in all our coding part not only one or two-part in all your coding part you will use only these four things like it will be mixture or it will be straightforward or you will be using. Something which is this for example you can like I will explain you in an example so that you can easily get what this integer. So integers are nothing but numbers for example these numbers will be like a flow numbers for example it will be like 1. For example, I'm just creating a variable called A and I'm just going to give the variable value as one and I'm just going to create a variable called B and I'm just going to give B is equal to 2. And here what I'm going to do is Max equation which is nothing but I'm just going to find C. For example, I'm just giving an A Max equation for you a is equal to 1B is equal to two. Find C by adding them like like like that. If I'm giving for example by adding them, what do you have to do is you need to create C is equal to A+B because you just given a question like by adding them you need to get an answer. So what you will get here you just given a value of you know a is equal to 1 plus the value of B. Which is equal to 2 so you will be getting a result of C so C is equal to 3. So that's what the same thing here you can notice one thing I hadn't given like 1.5 or 2.5 so if I'm giving that into the integer value what will happen is it will throw out me an error. So it will show that your code is having error. So you what you have to do is you shouldn't like for example in integer your number should be enough flow. It should not have any dot or any comma or any cool. OK. So that's very, very important. So for that only I just give an example. So these PDFs will be available on the resource like you know in our Udemy resource you will be seeing these PDFs in every video. So you can download that and you can use it, OK. So in there you can see it very clearly. Here I just given an example. So in all the like in all the codes, for example, if you take an integer, I just given an example of what are all the things you can do and what the output you will get. And for float, what are all things you can do? What result you will be getting? So I just given all examples. But here I'm just going to like, you know, draw and show you and we can go and implement on the thing. Also here I'm just going to give float what is float? Previously I said in. Integer you can't use something like 1.52 point 5 something you can't add some value like .5 or .20 point one because you know, if you come into the financial market most of the time, not most of the time, all the quotes you will be using float than integers because our price value or the data value of the numerical will most of the time end with 1.01 point. Oh that that so it will have some point because the price. Value or the numerical value will end up with points. If you come with the financial market, if it's going with other market, you will use most of the integers, but you're more than integers. We will be using float because our price value for example, if you take a Bitcoin, the Bitcoin price would be as of now let let us assume that it's like 66,000 point $25.00. It would be like this. So what I have to do is you just given a value like you just given 66000, but we have something like. .25 because price value will almost end with point. So for that you need to use float at most of the time if you are using a price value float is going to be the number one you know role which is going to place. So float is a #1 is very important you need to learn and next to 1 is Bolin. Bolin is nothing but to find out true or false for example for example if you write an algorithm where you will use a true or false. I'll explain you, OK. I'm just like you know, explaining with an example. So where we will use this true or false, for example, you just given a conditions for building your algorithm for trading board or for portfolio management or anything. You're just seeing if this this this condition met take an entry in our exchange. So you are just saying the code to do that. So for that if all these things met it's mean that it's true, right? If anyone is not meeting that it's going to be end up with false because one condition is mixing another 2 is matching. But if the condition is meant like if only three is equal to then it's going to be true. It's going to take entry on the exchange or it's going to manage the portfolio anything. I'm just saying as an example. So true or false, the bold in you will be using in most of the places. So make sure learn about the bowling and the next thing what is we are just going to see about the string like you would be having doubt where I'm going to use string in, you know, on numerical datas because I'm just going to deal only with numerical datas, right? Where is string placing a major role? You will be having that doubt for that. Will make you clear. You will be like for example, if you're taking a Apple stock, OK, what you will do you will add something like you will be creating a variable like symbol. So this would be your variable name. Variable name can be anything because for example, if you use sym for a short form of symbol. For example here I'm just giving a PPL which is nothing but the Apple stock. And what I have to do is if I'm printing, I need to call the same sym. So if I'm calling Skyrim, whatever the condition I just given inside the string, it will print outside me. So that's where the string, for example, you know most of the scenario for, you know, placing your company name or asset name or any kind of names. Because if you go with the numerical, you need to separate with the names. For example, if you take a Bitcoin, OK, the Bitcoin price is this so this the price of the Bitcoin. So throughout this price into the Bitcoin, so you will be throwing the price into the Bitcoin. So BDC will be here and it will be showing BTC is nothing. But now the price is 66. 1000 or 69,000 or any thousand or any 100 or anything so you need a variable to call it so you can see what is the value for that so for that the like you know you will be using the string in all your code all your coding part string will place a major role because string is very important. So now let's dive into the coding part. We just seen an example with these things let's go a little die one more again I'm saying guys again I'm saying so if you are going. Going with our PDF, I just given a full-fledged clear thing so that you can understand very easily. I just given that much easier and simpler things. You can go through that. And now I'm just going to show as a normal example, for example here, I'm just going to create a variable, OK, what variable? I'm just going to create a variable called a, which is nothing. But I'm just going to have a value because now we are just going to implement on integers. So let me add this as integers, OK? So what I'm going to do is. I'm just going to call A is equal to 1 and B is equal to two. You can ask me what is this A&B? Tell me that man, what you are doing A&B is nothing. But these are all local storage. You would be having doubt what is local storage. For example, you are just storing something inside the name of it. Because for example here not only a, for example here I'm just giving my name. TI and below I'm just giving two. OK, so now what I'm going to do is I'm just going to calculate. For example, I'm just going to calculate C is equal to a EBI. B, OK, you, you would be having doubt what you're doing. You're just given EBI plus B. Previously you said AB. I will come to that point. And now what I'm going to do is I'm just going to print the value of C because I need to know the result of C because we have a confusion that whether the variable AB is going to take on not. So now I'm just printing. You can see it very clearly. It has printed the value of three. It means that code is working perfectly. It is provided as a perfect result. You can ask me how because if you are a beginner you will be having this dog. Very simple guys. You can have the variable name like anything you want your wish. Because some scenario we would be having multiple datas at the same stage. OK, on that time you can't give a like lot of a for the same symbol. You need to give some other names to collect the data or you can use the list for that. But I'm just saying as an example. So for variable name you can give anything. Can be a. If it's a you need to change inside what are all things you need to change the ZB and you can print it for example. If you're not changing this, for example you're not changing the result part and what you will be getting, you will be getting a value of three because already I think the value has been stored. So for example, let me let me go like you know, let me go with A and let me go with a. So now if I'm running, you know. Now the value is showing us 3. So in this, you can make sure whatever you're going to add in your variable a or variable B, use the same variable inside the calling data. Calling it has nothing but whatever you're going to print it. OK, that's all guys. Very easy Coding is like coding in Python is not at all difficult. It's very easy. And now we can come to the float because now we just seen the integer. Now we can go to the float. Float also, same thing. Here I just taken an example. Let me copy the example so that you know we can print it very easily. So let me. Take the example. Let me take the example and let me show you. So let me print these two-part, you won't get any result. Let me go ahead with the full thing. We are going to print this. Let me copy this. Let me copy this and let me run this. Let me OK. Let me remove this so that the confusion won't be there. OK. So here what we've done exactly. For example, let me remove all these things so that you people won't get confused. Let me go with the simple terms out to use the float. Lot of time you know the price value, if you take the price, it won't end up like $1.00 or $2.00. It will have some sent inside that or you can go to any current, any country currency. It won't end up with like you know, 0.10. Point 2.5, it's like it will be ending with that it will have some sense or it will have some point value, it will have some decimal value. So for that here I just given a small example. I'm just going to print. For example, let me have like. Let me like have directly like this. OK, So what I'm going to do is I'm just going to add 0.1 plus 0.2. So you can see it very clearly. If I'm adding this two, I will get a value of 0.3. So we are going to check whether we are getting or not. So you can see it very clearly. You've got a value called 0.3. It's like adding the value which I just given. So we just got a value like 0. 3 OK and it's adding all the decimal value even you can control these decimal values like. I need only after the point, I need only four values or five values. But if you go with the crypto market or forex market or any kind of mark.To view or add a comment, sign in