 So now that we've talked about sort of representing data or at least somewhat getting into the idea of The different types of data that we can store in memory How do we store them and that is where we use a term? known as a Variable and the entire idea here is that this variable, you know just to think about it is I need some term to represent a location in memory So what does that mean if we think about the visualization that I used Previously where we just think about this as if it was a ram stick for our computer When I use or when I want to represent a well when I want to represent say the number five Right, I can put five in my code, right? We saw that on Jupiter, but what happens if I want to store that five? I need to use it later on in part of my code. I have to give it some variable name And again, so this X would be What we would call a variable and the variable just means I am Creating a block in memory and I'm giving it this valuation of a five store the binary representation of Five in this square now variables can also have different names. They don't have to be Single characters you see them a lot. It's not that they're not all over the place, but I can also give it a Much stronger name. So maybe something like a price. So price. Let's say I don't know for dollars and 15 cents well, once again, this price is Just going to represent a square in memory and then the value I associate to that is going to be stored Inside that square and that goes with every type of data. So if I came in and You know name Name Adam and I made that a string again once again that name is going to Be stored just to see that actually let me change colors here Name That is going to be stored somewhere in memory. Just allocate some block in memory for the Value associated To that name in this case. It is called name and I gave it the value of Adam So what can we do with this? Well again? This is where we can start to Build out our algorithms. For example, if I wanted to calculate the area of a rectangle Well, I could have a variable Called length and again, this is just going to in memory store a 7 and then I'm gonna have another variable and this time we call it with that stores some other variable called To or sorry some value to and then Location called height stores a nine Now I am creating a third variable and yes, that does mean that that is going to get its own slot But this is where we can sort of do something known as left to right association. You see In Python it follows this same format pretty much all the time On the left we are going to be dealing with the memory location So again length that memory location if you know Python figures out how to do that memory location It says that spot is going to be a seven that spot is going to be a two that spot is going to be a nine This spot is going to be the mathematical representation Or the evaluation of this mathematical expression Two times width times length with times height length times height So what is Python doing? Well every single time it looks on the right side It has to evaluate this expression. It first says well, what is the value of width? And so it goes into memory says, oh, I know the value of width. It's a two. What is the value of length? Oh, well, I know the value of length. It's a seven so and Then you can see it's gonna have the little asterisk going on there. So it says well, what is two times seven. Oh That's 14 Well, we're not done though, you know Pym DOS again says we have to continue doing this So again, what is the value of width? Well, it's two and what's the value of height? Well, it's nine. So this time two times nine. Oh Well, it's an 18 again Pym DOS keeps going so length length is seven Height is nine Seven times nine is sixty three and then what do we do with all of this? Well, again, Pym DOS is coming into play. We have giant parentheses around the entire thing going on here. So we have to add this up. This is a 32 That is a 95 So this entire evaluation Just change colors on it This entire evaluation is in 95 and we need to do two Times 95 two times 95. I think that's 190 off the top my head if not, you know Correct me, but now that I know my 190 I take that and I am going to store it in the Location that I have denoted for area and so I've placed it in here So just to sort of see this in a little more action, right? We have in our case Jupiter we can work off of Jupiter I can give it any variable that I operate with so if I came in and said something like item price is 499 right Now let's say for example, I want to calculate out I'm going to buy Five of these items so quantity T equals five and then sales Tax is going to be 7% So I've just established three variables item price how many I want of them and then what the sales tax of that is Now I have these variables. They are stored somewhere in memory just floating about So how could I then create a new value something like total? Oh? Well, you know, I want to do in this case Quantity times item price Oh, not quantity Quantity with a T there Now what we just see here is oh well, I won't see a value going on there That's perfectly fine because I didn't say in Python to show me the value, right? I said do the mathematical equation of quantity times item price store that in total Never in my code nowhere in my code. Did it say show me what the value was So in its world in Python's world, it doesn't I can come in and I can Introduce something like the print command print total. Oh, okay. Well, we get 2495 a bunch of zeros to a three You know, we'll we'll see that in a little more action later on of why that's Thing but as you can see, you know, oh, well, we can get a Calculation going on here just for our sake since that is a little overly complicated I'll go in and let's say the item is a five dollars and fifty cents. We can call this the Math tax because we want to get rid of this thing. Ah, so again, oh well five times 5.5 equals 27.5. Okay, so now we can continue. I haven't done anything with my sales tax yet So this is where we get into once again this idea of left to right association Total currently just has the total value Stored inside of it But I could come in and say something like total equals total Ah Plus total Total times sales tax So what is this going to do? Well, just to look at this total again is 27 And I'll even add this in above it location Equals to seven five Plus two seven five Times zero point zero seven Again, so we're effectively saying take the twenty seven point five right keep that we want that plus Seven percent of twenty seven point five, I'm not gonna do that math you Do it as a thought experiment. I don't know but take those two values add them together Then make that the new value at my total location. So in this case if I came in and printed my total afterwards I Should see a value of in this case 27 plus total times sales tax, which is roughly it looks like 1.9 ish 1.95 ish going on there so 27.5 plus 1.9 ish will give me a total of 29.425 awesome Now when it comes to again naming these variables, you know, you can name them with Single characters, it's not against the rule. It's Try and be more descriptive whenever you can is the word the way I will describe it, right? When I do something like Quantity times item price Equals total and then like sales tax times total these words these variable terms make sense. We aren't trying to Guess what each value is going to represent, right? That would be much harder if I came in and gave these Values right or sorry D, right a equals 5.5 b equals 5 You know none of that makes any sense from a Literal standpoint, so you know try to choose, you know your naming perspectives There are other word rules, you know as you can see one of the things that I like to do is I like to follow the lower case with underscores naming convention So if I have a variable that has more than one word to it So like item Name right You know just to finish this up banana Yeah, right. I'm using an underscore here to Represent the variable going on there. There are some more fancier rules to it Obviously, you can't start with a numerical value. You cannot have weird crazy symbols in there and then there are some Words that Python is going to say you can't do that. You cannot say for example class I can't say class is going to be equal to 5 Right, it freaks out because class is an a word that Python uses for other things And so it's just saying you can't change that don't don't try and break Python on me going on there so the last Thing to sort of talk about is The role of variables and there are just like with different data types There are tons of different roles that a variable can play with and for our sake Don't even worry about the vast majority of these so just ignore like these and these For right now To at least start focusing in on just these three that I haven't touched Constant variables the entire idea to a constant variable is I don't want to change that variable Right the items price. I never want to have item price Once I've established item price. I never want to change the value of item price same kind of thing I never want to change the value of sales tax. These are values that shouldn't change But something like a gatherer This is now taking in those different values and applying them if I say for example wanted to Include I can't really do it in this context. I think Or I guess it would be like if I had another constant called quantity Wanted T times Item price right that would be a way for me to you know Gather up those values into a single variable and work off of it gathers can as you can see sort of from here Get rid of this one Gathers can Operate on the right side. There's nothing against it and there's no, you know Python police That you're gonna have to deal with but The entire idea here is a gatherer can be on the right side meaning you can Use it and then it can be on the left side. You can change it again as you can sort of see here total or Rather me undo you and then change Let me do it a little differently. Let me come in here and say Ah Yeah, that works total We're oh, yeah, that's why my apologies I was trying to find it and this is again This is the perfect reason why you don't you know name those variables like very basic simple like D Kind of things because then you can't figure out where your total is Here total is again a gatherer style variable. It takes and Establishes the quantity times item price. So it does that calculation, but as you can sort of see here This is a value that I'm okay with changing, right? I don't want to change item price I don't want to change quantity or sales tax depends on again the context, but in this case total perfectly fine it to Adjust it make changes to it and so again, it is this idea of just it is a Gathering style variable temporary as you can sort of guess they're just meant to be one-offs there That's where your your single character. I need to make a quick Variable real quick kind of approaches come into play But again, it's this idea of your your variables have different roles attached to them And so it is your your job to sort of make sure you can understand what that role is that way you don't Mess up some of your variables So you don't accidentally change item price from 5.5 to 5,000 because you accidentally Changed the value at that memory address