 Okay. Well, hello to everyone. We had a little bit of technical difficulty there, but we're live now. Welcome to Introduction to Python, the review of unit two. Everyone who joined us last week, thank you very much. As I've said before, and I will put in the link, if you guys, my fault, everyone, I just heard my own audio and that's why I reacted so scared. If, of course, if anyone, this is Introduction to Python unit two, if you haven't started the course, or if you're on unit one, please go back and check out our live stream from last week. Catch up. We're going to be doing these for the next eight weeks. And if anyone has any questions as we go around, I would definitely recommend you put them in the chat. I will make sure that our fantastic presenter, Dr. Sack, will answer them. If you'd like to continue your conversations more, you can go to our Discord channels on sailor.org. And then, of course, just to remind you, this is the Python course available on sailor.org. I will put all of those links in the description and in the chat. But without further ado, so we can have the most amount of time to learn, Dr. Eric Sack, you can take it away and tell everyone what we're going to learn here in Python unit two, or what they should have learned. They should have done it already. Well, hey, everybody. I hope everybody can hear me okay. And so the next step after getting the interface up and running and just learning how to assign variables and do some basic variable initializations and so forth is to understand how to play around with them a little bit. And probably as a precursor to more sophisticated programming constructs, we need to know how to operate on variables. The minimal thing that you want to be able to do is be able to use the computer as a calculator. So that's where we kind of get into the notion of arithmetic operators because you want to do arithmetic. That's the most basic thing that you would want to do on a computer. Well, I take that back. There's really two things. Historically, it was either for computers or either for calculations or they were for data processing, processing of string and character data or a mixture of the two. And so we'll get to first get into our arithmetic operators and then talk about relational operators because oftentimes we're really going to need to do comparisons and then finally logical operators. So we'll dive right in. And so probably the best place to go is the course itself, which is unit two on operators. And I just I want to preface this. I'm sure that you all know how to use a calculator. You know how to add, subtract, multiply and divide. So those those operations really aren't too difficult to absorb. When you go into different computer languages, the idea of like taking a number, you know, well, let's just so plus minus star is multiplication and the slash here is division, typical division. And the and then we get to exponentiation, which is two stars. So if I wanted to say something like three squared that I would write three star, star, two, like this, that would be the syntax. Okay. And I just want to so hopefully everybody has this down. And you know, I had a question yesterday. And again, like for me, having done this for so long, like it's easy to forget, it's easy for me to forget, like the initial kinds of mistakes, unless I sort of teach at the introductory level, the kinds of mistakes that could be made. But I had a student yesterday. And, you know, I wouldn't, I wouldn't, I don't embarrass him. He wouldn't want to say his name, but I'll give us a phone number and address at the end of numskity. But yeah, I had a student who had a question and who who was trying to program the law of cosines. And it went something, the equation goes something like this. And, and this speaks to exact or exactly one of the major, major things that's when somebody starts out, okay, times the cosine of some angle, call it, I'll use a letter, I won't use, I won't use like a Greek letter, I'll use like a letter G. So assuming these variables have been initialized, assuming that like, that, that C were known, A were known, and B, B equals 10, C equals three, A equals five, you know, simple instructions like that. He had, he wanted to solve for, for the cosine of G. And so this is the law of cosines, whether you know that, if you know trigonometry, it's irrelevant. This is just an equation. What's important is that this is a mathematical equation, and this is an equal sign that, that describes equality. And so if you were doing this in Python, and other languages would use, and that's, that's another point you need to bring up is that, is that different languages use different syntax for exponentiation. And so, but, but what he was trying to do, I'll try and translate it to Python, what it was a different language, but he was trying to translate his the equation into this. And this is what he had, effectively on his, in his program, in his code, like this. Sorry, that's an A. And then plus B star, star B, you know, minus two, you know, blah, blah, blah, blah, blah, blah. And he, he was trying to keep a faithful reproduction of the, the mathematical equality. And he programmed it up like this. But this, my friends, is an assignment statement. And I was trying to show him that, that you need to have a bucket or a variable over here, you know, call it Z. And then Z, you're going to have to understand is carrying whatever is on the right side of the equality sign. So it goes in this direction. But, but I just, I'm trying to bring out the error that I saw this person make because it's fundamental, it was very basic. But it was a, it was, it was causing him to not get his code to work correctly, because he was trying to draw a one to one equivalence between the equation and the syntax of the programming language, which is completely disallowed. Because you can't have anything on the left side of the equal sign that would represent a mathematical, it just has to be a variable. There are variables on the left, and there's stuff on the right, and the stuff flows on the right into that bucket on the left. And so I just wanted to kind of, so as a review from last weekend as a lead into this week, because we're talking about operators like exponentiation, for instance, you know, I just want to be clear that, that one, one of the goals of programming is in fact, sometimes you do have to take an equation and translate it from the mathematical form into its specific language syntax into those language constructs. And sometimes there isn't always necessarily a perfect one to one translation between those things. And that's part of what I want to talk about in these few minutes. So if we go back over to, let's say the, the rep, rep, replet window, I think the, the, well, the operator, the operators, let me come back over here again, let me clear these drawings to the operator. So again, I think you all understand plus, minus multiplication and division to other operators. This is called integer division. And this operator is, is the modulus operator, what you get from integer division. And, and this is where you got to be careful, you know, going sometimes students accidentally fall into Python two. And, and there's, there are slight differences between Python two and Python three, and it has to do with this division operator. And this syntax was developed specifically to handle if I wanted to divide the number seven divided by two, but I want to throw away the decimal part, and we all know seven divided by two is 3.5. So you would expect a floating point answer from this, right? But in this case, what happens instead of 3.5, you'll get the number three. And then we throw away the, the decimal part. So this is an integer operation. So, and the answer that you get out of it is inherently integer based. It's not a floating point number. This division operator will get you floating point numbers. And again, I don't have time to go into the whole history behind that, but, but Python three addressed the issue of this issue of division in, in Python three. And the percent operator is just the remainder after dividing by a number. So if I say three, if I say like 21, four, okay, this is equal to 21, the remainder of 21 divided by four, which is equal to one, or 27, let's say divided by five, the remainder would be equal to two. So that's what the modulus operator gets you. So it's, so it's important the interplay, to see the interplay between these two operations, the double slash and the percent operator, because one gets you the integer part of a division, and the other gets you that basically the remainder of, of an integer division. So they're inherently integer based operations. And you really, you need to pay close attention that if you're using the double slash, you're really being intentional about using integers. And similarly for the mod modulus operator as well, that's, that tends to be, I mean, like I said, you can redefine it in ways, you know, where, where you could probably handle something within floating point, but we don't need to go down that path to the point is that the percent operator and the double slash are meant to be into, they were designed to be integer based operations. And then one last thing about the modulus, I want you to recognize is that it forms what's, I'm not going to go into the math behind this, but too much, but it forms a congruence. And so if I'm counting with, with integers, and maybe I'm going to count from, make this zero, and that's minus one, minus two, this is, this is an important to understand, because different languages actually do different things with this percent operator. And it can be a little frustrating at times. And again, I don't have time to go into all the differences, but, but Python actually does compute the true modulus, you know, the true remainder according to the definition of mod, what are called mod congruences. And what that means is this, is that if you have integers make believe, and I'll say dot, dot, dot, you're accounting from, you know, a very negative number to a very positive number. And I'm interested in computing numbers mod three, okay. So zero mod three obviously is zero. One mod three is two. Two mod three, the, the integer division of three divided by three would give you a zero back again here. Four mod three is one, because four divided by three would give you a remainder of one. Five mod three we equal two. But this, this performs like a periodic sequence. And, and this is how the definition of the modulus works, is that if I, if I, if I attempt to compute, for instance, minus two, so this would be mod three or percent three, mod three in Python, this would translate into pi, into percent three, that minus two percent three will give you a value of one. And that's not, it's, again, I don't have time to go into all the differences. That's not necessarily true in every language oddly enough. This is this really, Python really stays true to the, the notion of what's called a congruence. And the congruence basically takes the integers and wraps it around periodically around these, these digits zero, one and two for the case of mod three. So, so all I'm trying to say is that this, for those of you who understand what I'm saying, this, this is a true modulus operator. And I'll leave it at that. Okay. So that's all I want to say for initial introduction to arithmetic operators. If anybody has a, has a quick question about anything about arithmetic operators, I'm going to go on to the next idea that I want to present to you. Yeah. The chat does not currently have any questions for you. I do. First of all, I would like to say very humorous. You're like, everyone knows seven divided by two is 3.5. It's like, no, everyone but one person. And the other, the other question I was going to ask you, and this is maybe covered in the course, but I thought we could talk right here. When you say Python two versus Python three, are you, you're talking about the versions, correct? Yes. So Python two was an older version of Python. We are, we are in Python three. And there again, there are slight subtle differences when it comes to like the print command and also integer division. And so I don't want to, you know, go too far down the path of what those differences are. Suffice it to say that, that Python three has two division operators, one for floating point divisions and one for, for integer divisions. Excellent. I think I'll wait. I'll see if anyone has any questions in chat. But for now, I think we can move on. Okay, great. So the next thing that happens sometimes, you know, more at the introductory level is if, if I had, if I define, let's say, a bunch of numbers, let's say, you know, B is equal to two. And so if you want to follow along and replete and try and type this in, it's completely, it's a great idea. C is equal to four. D is equal to eight. And I don't know, E is equal to seven. Okay. The key thing to recognize is that like when you're writing equations, and this has to do with the order of operations or what's called operator precedence, they follow the basic algebraic rules that you would expect, you know, that you might have learned in like an eighth grade algebra class is that you perform multiplications before additions, you perform exponentiations before you perform multiplications and divisions. And then if there are parentheses, the rule is whatever's in the parentheses, you know, you do first. So if I would write something like A plus B divided by C, for instance, I'm sorry about that, I'll say I'll do it like this, I'll print it out right away. A plus B divided by C. What your eyes should be doing is they should be scanning from left to right. And, and then, of course, we probably learned that maybe you learned the term PEMDAS, that's a very common type of a term to say parentheses before, you know, multiplication and division, multiplication and division before addition and subtraction. So you look at this expression, and you look for all the multiplications and divisions are, and then you perform the additions afterwards. So in this case, you would first divide B divided by C, which is a half, and then whatever A is, you would add to it. So back to that number, oddly enough, 3.5. So that's a, oh, wait, I'm not sharing. I got to share the right screen. I'm so sorry. This happens sometimes. Apologize. Yes. Yeah, there you go. You're back there. Okay. So, so, so B divided by C is performed first, and then the A is added second. So if we go ahead and run this, then, then we should see the number 3.5. And so, so if you wanted to, if that isn't what you wanted to do, maybe you wanted to add the numbers A plus B first, well, if you want to do that, then you've got to put parentheses in there to do the addition first to sort of override, to override the basic language construct that obeys basic rules of algebra. So in this case, you're saying you actually want to add the two numbers first and then divide the C. This is probably most important if you're ever going to do any programming where you have, you know, fractions with long numerators and long-winded denominators. And so, so if we run this, then, of course, you just add A plus B and then divide that by, by C. So now you'll get 5.4, which is 1.25. So, but if the, the thing is, is that is, is that probably the most common error that I've seen sometimes is if you wanted to do like A plus B divided by C plus D, something like this, oops. And with regard to the order of operations, excuse me, this is going to first take B divided by C, again, which we already agreed was a half, add A plus a half plus D. And if you had A, which is 3, D, which is 8, and then you add the 0.5, you would get 11.5. If you want, if you didn't want to do that, like probably oftentimes what I see sometimes is that people say, oh, well, I was trying to program a fraction to do this. I wanted to add the numbers in the denominator, I'm sorry, the numerator first. And then I wanted to add the numbers in the denominator second. And I wanted to divide those two numbers. Under those circumstances, you've got to be intentional about, about those calculations. And that's what, that's really what I, what I mean by trying, trying to stay true to an equation because, because sometimes with equations, this isn't always, you know, true, like, like you might encounter something that might, you know, while you're reading something to say, oh, program this ups, program A plus B divided by C plus D like this. And, and when you do that, you've got to translate this over into Python, Python syntax. And of course, that's where you'd have to add the two numbers in the numerator first, and then divide the two numbers in the denominator second. And then Python smart enough to know by its order of operations, you know, that you want to do the division of those numbers that are summed together within the parentheses. So it's a subtle point. And it's not difficult to understand, but I'm just saying syntactically, I've seen it's these are the kinds of errors that happen. Not because someone doesn't understand the order of operations or not because they don't understand how Python processes the order of operations, and sort of the mental conversion from an equation that one reads on a piece of paper, to actually writing the syntax for implementing that equation. And sometimes these little types of mistakes arise, just because one forgets, oh, I need to, you know, you figure it out at some point, you need the parentheses somewhere to make the calculation do what you wanted it to do. So there's a certain measure of intentionality when it comes to using parentheses. Now, sometimes when students start out, they'll start writing expressions with like parentheses all over the place just to be safe. And that's going a little bit too far on the other end of the spectrum as well. So you want to kind of have a balanced approach, like for instance, make believe that I wanted to raise, you know, take like a squared plus b squared. Okay, here's a case where I'm going to compute a squared plus b squared. And when I do that, I'm going to get the number 13, because three squares nine and two squared is four. Now, what would happen if somebody were first starting out because they might be concerned about the the order of operations, they might intentionally say, okay, well, I'm going to put, I'll put parentheses around the, around the a squared. Okay, just to make sure that the exponentiation is done first. And, and then maybe make sure and put parentheses around the b squared, just to make sure that the, the exponentiation for b is done as well first. But, but this is unnecessary, you know, so sometimes parentheses fall into expressions that are unnecessary, because we know from the order of operations that Python will perform the exponentiation long before the additions ever take place. So it's not incorrect, it's not incorrect syntax, it will actually work. But, but again, it's like when you start to get expressions with like 20 sets of parentheses to implement something, you got to take a look at it, say, do I need all these, you know, so there's like a balance between readability and, and functionality. Okay, that's about all I'm going to introduce for arithmetic operations, just because the amount of time we have. But, but I'm happy to entertain any questions about integer divisions, or modulus, or order of operations for arithmetic operations, anything at all. So, I'd like to say, the algebra thing, I never consider that it was blew my mind. I'm, I'm learning so much. I don't know if I have a question related to, but we have a question here in the chat, which I Googled, so to make sure the question, but it was asking if about your IDE or integrated development environment. Yes. They were asking to, I guess, to know more about yours specifically. Okay, so it depends, like oftentimes I'll use, I'll use, well, I'll usually teach with replet, and I'll use replet to, if I just need like a quick and dirty, you know, I'd like to test this out, or I want to, you know, test that thing out. If I'm trying to communicate probably more research types of things, I'm more inclined to use Jupyter notebooks that uses Anaconda Python 3. So Jupyter J-U-P-Y-T-E-R is, is another one that people use all over the place. So this is, and this is easy to find. Again, the, the sometimes the, with any type of installation, there are always potential issues with regard to paths and, and, and setups. And, and, and in an ideal world, these types of installations, you know, should go seamlessly. But I have seen small, you know, two or 3% of the time, when one does an installation, sometimes, you know, Anaconda will get confused about, about, you know, where it's looking for files and so forth. If somebody does, makes some assumptions or does something during the installation, because the paths weren't set up correctly, it's all fixable. But I just don't want to introduce those kinds of headaches at an, in an introductory course like that. That's really why I use this ID. So replet I use for either just testing small chunks of code here and there, just to have something quick. And then if I'm communicating larger results, Jupiter notebooks, and I was probably more into like, you know, Microsoft, you know, Visual Studio for a while. And then, you know, like I said, I probably, it just gets gets confusing, sort of jumping from one tool to another. But I still use it occasionally, but I'm probably more, I probably lean more towards Jupiter notebooks, you know, also to communicate files and so forth. I hope I'm answering that question. Awesome. I think you answered it for me. So I think that's pretty good. We can probably move to the next one. I'll let you know if we have any other questions. Yeah, but it's like, it's people, sometimes people, computer scientists get territorial. It's like, oh, using that ID, you know, you know, that's a terrible idea. It's like, whatever, you know, it depends, you know, if you're doing, you know, a couple of them, right? Yeah, right. So, but I'm sure you do. But I'm just saying like for develop and also for development, for going from soup to nuts with with Python development all the way to a final, you know, standalone application, that's really not for this course. But you need a couple of extra hooks in place to get beyond Python scripts, by the way, because ultimately you want to, if you're writing applications, you want to convert that into low level code that could be executed, you know, independently of an interface. So there's a whole pipeline that goes beyond, you know, just typical basic Python scripts. So this is very introductory stuff that we're doing right now. Okay, so I hope I answer that. All right, next, the next thing, I would say the next piece of information that you need to really be good at is just, you know, feeling comfortable with relational operators. So if you, you know, if I set up the number a, equal to five, and again, these are not the most exciting variables in the universe. So don't, you know, it is what it is. And so if, if I wanted to ask the question, you know, is a equal to be, this is where the relational operators come in, because you, you are no longer performing an assignment, you're not trying to talk about equality in the map in the mathematical sense that you would be attempting to assign a variable using the equal sign. We're just trying to compare two values. And if we go ahead and compare them like this, then obviously a is not equal to b. So you're going to get a false answer. So, so another data type, okay, that we need to discuss if I haven't mentioned already is the Boolean data type. It's whether or not something is true or false. And so Boolean data types, the type bool. So if I were to say something like, you know, x is equal to watch this in slow motion, I can set x equal to the result of that calculation. And then I can ask the type to tell me the type of that particular variable type and the variable type. So so far we know int, string, and, and float, and now we're adding bool to the list if I didn't do that last week. And so, so if, if I set b equal to five, well, obviously they are equal, so I would get, I would get a true out of that, you know, I could say print x here just to speak things along. So it would be true. So Boolean variables take on one of two, you're in a Boolean universe, it's one of two possibilities, nothing else, something that's either true or false, but not both. And, and that's, that's, it's as simple as that, there's nothing complicated about it. Now, I could ask if, if a there are the relational operators you got to be comfortable with, is it greater than or equal to it, be a is greater than or equal to be right, but it's not greater than be so a greater than be should be false at this point because a clearly is not greater than be a has been defined as five and B has been equal, defined as five, if I, if I change B to a three, and then this result would change to a true because now a is five and B is equal to three, and one is greater than the other. So, so the, the, the relational operators are a double equal are, you know, greater than, greater than or equal, less than or equal to, and, and less than or equal to less than and not, and then not equal. Okay, because we want to know, so a clearly is not equal to be so that results in a true, in a true result. So those are the, so when you're using relational operators, very straightforward, you're just trying to determine the relationship between two variables. And again, once again, the rule is going to be the same algebraically, if it turned out, for whatever reason, you wanted to write a string of relational expressions for whatever reasons you would have, you know, that, that we're going to get to this in a second because I'm going to add logical operators in a moment is that, is that the progression still is from left, the processor still is working from left to right one attempts when it sees more complex expressions. And so I'm going to get to that now. Now, where I'm going with all of this is, is that you've got to be for next week, you've got to be like a million percent comfortable with relational and logical operators because they are instrumental to, to writing, you know, what we're going to introduce in terms of conditional statements and loops and so forth. I think it's next either it's either functions or, or, or, or conditional, but at some point within the next two units, we are not going to be able to get away from having to be experts with relational and logical operators. So those are. So those really are the relational operators. That's that's where we are with this. It's, you know, greater than or less than, less than or equal, greater than, greater than, greater than or equal to equal, equal, not equal to see if I left anything out, but that seems to be a good list for now. So let's go up like that. And that's all there is to it. You're just the reason you're using these is because you're interested in the comparison between sets of numbers. So is everybody good with this? That's the second thing that I wanted to talk about. So I'm happy to entertain any questions whatsoever. We have not had any new questions. I can say that next week's unit is input and flow control statements. And the week after that is data structures. Okay, so yeah, so the input, the flow control is going to involve, you know, everything with with input with if statements and so forth. So, okay, um, let's thank you so much for that. I know what should come next, but I gotta, I gotta sound like I know something once in a while. It's like, it's my first day on the job. Wait, I designed the course. What are you doing wrong with you? Also, I should have pointed out before people found your other answer very helpful. Okay, that's excellent. Good. All right. So the last thing that we want to do is is kind of broach the subject of logical operator. Sometimes in some text, you'll see them call them Boolean operators. I refrain from using that because I don't want to get that confused with, you know, just the word bool, which is which I usually try and reserve for the data type. But, but, you know, again, it just depends on, you know, who's who's talking and what their language is and what they prefer to use. So you'll hear me use logical operators. And so those are the, oopsie, they said those are the the logical operators not and and or so so I I don't know if I can overemphasize just at what point it's so important to know what these operations do because I find so often that students get on the other side of that of that next unit, still being a little hazy about what these operations do. So all and not does is just take the called logical complement. Sometimes it's called logical negation. It just takes a true and turns it into a false and it'll take any false and then turn it into a true. So something is true, it'll become false and something is false. So it'll become true. So it's kind of like the equivalent of arithmetic negation with a negative sign. If you put a negative in front of it, but it's logical negation. If you put the not in front of a true or a false, you get the opposite. Okay, for the and and the or in the course, I'm not going to take the time to do this, but, but at somewhere, there's this mention that has to be mentioned of a table of some kind that tells you sort of what happens in the event. Let's talk about the and let's say, you know, in the event that that you have a true, let's say true, false and false, and then true, false, and then true, false. So this is called a truth table. And if you take the and of a true and a true, you should always get a true out in any other event. You should always get something that's false. So logically, the logical Boolean definition, you know, according to Boolean algebra and Georgia Boole, who lived, you know, 150 years ago, longer than I know, and 100 got about 1850 or so, so and, you know, may he rest in peace. I don't know what I'm saying. So the, the only way an and can be true is if both operands are true. And that even though I would like you to learn this table, the the most important thing is that is that when you write out conditional expressions, when we get to that point, you're going to see have sort of strung together a bunch of different logical conditions, and you might be anding them and oring them. And so you want to sort of immediately you want an immediate visual way of sort of ascertaining the result of a logical calculation. Is it true or is it false? And the way that you do that is just by looking at two terms, for instance, that might have an and between them. And then you look to see if those two terms are true. If either one of them is false, you don't even detect both. If you see one is false, you're done. Okay, you know it's false. The only way that an and can be true is if both expressions are simultaneously true. And that's the way I want you to kind of think about it. You know, that's the intuitive understanding for the or operation. It's, it's different. It's, it's, it's true, false, true, false, false, true. If you take the or between a true and a false, let's say, or a true and a true, this will get you a true. This will get you a true. This will get you a true. And then finally, the only way that you can get false from an or operation, it's a, you know, it's a, it's a binary operation. It's an operation between between two operands. Is that if both operands are logically false, then, then the answer comes out to be, becomes false. So the way that you're anticipating using ands, ors, and nots is, is sort of like a, you're taking combinations of relational operators, for instance, that's a very, very common way to, to apply these, you can get tricky and do a lot of other interesting things, you know, but at, you know, at the initial stages, you know, you would, you would say something like maybe x is equal to a greater than b, you know, or, you know, maybe I'll try something like this or somebody from back here, or, I don't know, five greater than one or something like that. Okay. And I'll say a less than b here. So just to hit home with this. So if we go ahead and run this, let's print it out, we go ahead and run this, we're going to get an answer of true. Now, a currently is equal to five and b is equal to three. So a clearly is not less than b. So this first piece here of this expression of this more, you know, lengthy, logical expression is, is clearly false. But this is true. So we take a false result and we or it against a true result, then we expect that we should get a true result out. If we were to end these together, okay, since the first condition is false, and the second condition is true, then now we're going to be taking a false and ending it with a true condition under these circumstances, we should be able to predict that that result is false. And so there's both a, you know, there's like an art and a science to evaluating, you know, lengthy logical expressions because what I would say is this is that if you're really interested in the subject matter more, more for a deeper discussion, you should study a tiny, tiny bit of Boolean algebra. That's kind of like the crux of computation. So if you oftentimes what can happen, for instance, is that you may write down a long logical expression. And you might wonder whether that's equivalent to some other logical expression that doesn't look like the first expression. You could you could actually prove stuff like that using Boolean algebra to show that there's logical equivalence between one and the other. You know, right now at the sort of introductory level, you know, you just want to be at a point where you can sort of mentally sort of break down an expression like this. So as you're reading it, you know, your eyes can ascertain whether or not you get a true or a false result from that expression. Okay, so that's that's really kind of what's going on here. So are there any questions? So so far, we've gone through arithmetic operators. We've gone through a little bit about relational operators for comparing values. And then, of course, now what we might want to do is take logical combinations of Boolean variables or Boolean expressions so that we can form more complicated expressions that can do more more interesting things. But again, in order to do that, that that implies that you understand the the and the or and the not operations. So I'm happy to pause for a couple of questions, because I want to say one more thing. Well, we don't seem to have any questions. We'll give everyone a chance. But I figured since it came up, I thought I would do some math myself. George, George Bull died December 8, 1864, which was 156 years, two months and two days. I thought while you're doing some math, yeah, I mean, it's really amazing to me. I go, I tell, you know, different students, it's so funny how he was just a mathematical philosopher. He had no, there was a guy Charles Babbage who tried to invent a mechanical microprocessor. And they met historically, according to history, they met maybe once or twice or something. And like George Bull sort no connection, at least this is I think this is historically true between what he was doing and this computer that that Charles Babbage was trying to the inference machine, he was trying to to sort of build an event, but he never built it. It was just too complicated for mechanicals. So like a mechanical computer, you know, but George Bull was like, like instrumental, all that Boolean algebra is like instrumental for igniting the computer age, basically, like we wouldn't, we wouldn't be sitting and talking right now, if it weren't for the algebra that he had created, you know, but he saw no relation, he was like, crazy computer crazy, you know, I mean, maybe a little bit, you know, I'll bet you saw some connection, but not up to say, Oh, if you just, if you combine these two motors in an and operation, you know, you'll get it, you know, that kind of like, there's nothing like that to say. Okay, anyway, back to the program. And, okay, so, so the next question becomes if, if you're going to have this whole list of possible operators in Python, like what are the rules for their evaluation, you know, it's very, it's very possible that in a computer program, you might see combinations of, of arithmetic operators and logical operators and relational operators, you know, so, so what I just did, there was something very, very implicit that took place. And I did this on purpose because I wanted you to, to sort of think about, you know, this idea even now, even in this expression, just nice job. So let's just make something up where we had something like this, let's say, and, and there's something implied here that, that I'm doing. And that is with the, with the parentheses, I am asking Python to evaluate those relational operators, and then I'm evaluating, and then evaluating the, the logical operator, or next, okay. So, so this is what happens, again, so a is, in fact, greater than B, or five is greater than one. And the question is what would happen if I took these parentheses away? Could I do that? Would I be allowed to do this? Would it even make sense to do it? And the answer is, is, you know, the short, the short answer is yes. Okay. And so if the answer is yes, then we have to have a discussion in some sense about what the rules are for how these expressions would in fact be evaluated. Okay. And that has to do again with operator precedence. So again, the final, one of the final sections of the order of the operator section is about it's sort of like, or operator precedence revisited. Okay. And, and the reason that's being revisited is because, you know, by the end of that unit, we've introduced arithmetic operators, we've introduced relational operators, we've introduced logical operators. Now the question is when we start taking combinations of these, you know, who's going to win? Who's the winner? You know, in a string, if you're reading from left to right, for instance. And, and I don't mean a string variable, I mean, just a stream of logical operations. So under these circumstances, what are the rules? What happened here? Well, apparently, I may not have needed those parentheses. After all, you know, or did I need them? Was I taking was what was I doing this instead? You know, was was this actually accidentally happening without me knowing it? You know, was this being computed? For instance, believe it or not, there's nothing wrong with this. I don't have to I don't want to necessarily go into what happens when you use logical operators with numerical values, you know, you've got to understand a little bit more kind of at the at the binary level, what's going on to to make a statement like this. And you may not want to do this. But this could be what's happening in the background, because maybe the logical operator is actually if you leave out the parentheses, maybe the logical operator is being evaluated before the relational operators. So what are the rules? Okay, well, that's where in the course when it comes to operator precedence, if we pop back over here, there's a table. And this is a very, very important table that isn't so much that you're going to memorize this table, it'll become natural. And we're not going to be able to in this course teach everything that's on this list. So for instance, you'll see that there ands, ors, and nots, we're talking about those logical operators, there's also what are called bitwise values. In order to handle the bitwise operators, you need to know a little bit about the expansion of of numbers in base two, so that you want you sort of understand what's taking place in numbers when when you're using their bit representations. And so this course doesn't go into that at all. So for now, you know, at the introductory level, the bitwise and or and nots, you know, aren't going to be relevant, but they're on the list and shifts as well, you can shift bits around as well. But, and I don't know why they made this table, I would have flipped it upside down, because exponentiation will get into indexing later in the course. So so right now, for all intents and purposes, what you need to know for this unit, exponentiation has the highest precedence. And therefore, for some reason, they put it on the list at the lowest level, which can be confusing, but but flip mentally flip it upside down. The next test to do with negation, which is nothing of subtraction or addition, just when you negate something, the negation is going to take place first, which is completely legal to do. Then we have multiplication division, floor division, or what I'm calling integer division, and the remainder, okay, which is the modulus operator, okay, then we get to addition and subtraction, then watch this in slow motion. Now this is very, very important. The relational operators come next, and then the Boolean operators come at the low end of the totem pole. Okay, and we'll get to all this other stuff later as well. So for what we know from this unit, from exponentiation, then there's negation, then there is multiplication and division, addition, then subtraction, and then the relational operators, and then the Boolean operators. Okay, so this is, this is, this is huge. Okay, because now when we come back over to the expressions that we have here, we know, okay, well, because of the operator precedence, what's happening is that the relational operators are in fact being evaluated before the OR operation, okay, before the OR operation. Incredibly important that, that relational operators have a higher precedence than the Boolean operations. And that's what enables us to write expressions like this, you know, without fear of the, of those values. You know, you can know so little that you wouldn't care, but then as you start to learn more, then you think, oh, I wonder what would happen if I didn't put the parentheses in? Is this going to get a, which is going to get evaluated first? Those are the times of questions that arise as you start to write more and more code. So in this case, in fact, the a greater than the, and the five greater than one is being evaluated before the OR. And that will be, that holds true for the AND or, you know, really any combinations of, you know, of expressions and so forth. Is it wrong to put the parentheses in? No, no, no. Again, you may want to make this, in this case, it's easy, because there might be readability reasons, documentation reasons to make your code look pretty that, that you might want the parentheses in there, but you don't necessarily, for the sake of readability, but you don't necessarily have to do it because as experts now, you know that the relational operators occur before, before the, okay. And so something like this though, let's say a plus b greater than seven, let's say, okay. So now your expectation is that if you wanted a logical expression to add the numbers like this, okay, then you'd be asking the question, you know, is a plus b greater than seven is a greater than seven. So in this case, you would expect a true because it is and let's take the parentheses away. And again, of course, because of the fact that you're going to, because of the fact that the addition takes place before the greater than evaluation. So, so even though the parentheses aren't there, okay, because of the order precedence because of this of the order in which the operations are evaluated, the addition is going to take place anyway. Okay, so you wouldn't be, you know, taking b greater than seven and adding it to a, well, would you ever want to do that? Believe it or not, you might, you might, you might want to take and and pythons, funny enough, Python is smart enough to, to figure out what you mean sometimes, you know. So, so in this case, watch this in slow motion now is that b greater than seven, okay, is, is a Boolean value. So it's not Python, Python is going to assume that you know what you're doing, that you, let's do it this way, let's say b less than seven. Okay, so, so, so it's possible. So, so this is just one other subtle point, I don't want to go too far on a tangent, you know, there may be cases where you actually one day want to do something like this, and it's possible. And Python is smarter enough to figure out, oh, I've got a Boolean variable over here, and I've got an integer variable over here. What I'm going to do is I'm going to upgrade the Boolean variable from zero in this case, I'm sorry, I'm sorry, b less than seven. So, so if there's a numerical conversion, if there's any sensible numerical conversion for Boolean variables, it would be true is equal to one and false would be equivalent to a number zero. So if b less than seven is actually true, because three is less than seven. Python would understand, you know what you're doing, that you actually mean to convert that Boolean value to a numerical value, which would be one in this case. And then, a would be five and five plus one is in fact six, you know, so that's, so, so sometimes when you mix these expressions together, you know, Python is going to take leaps for you because you're trying to it thinks that you're trying to do some type of type conversion. And that's why it's important to understand the operator precedence and how parentheses are important, because you could potentially end up with a result that you may not want to, you know, end up with. And, you know, that's why we're showing examples arithmetically. And that's the bottom line, I think to do to master operator precedence and to master the order of operations and to master the various types of operators. It means that every time you write an expression for whatever reasons you write it for that might might involve a mixture of arithmetic, logical and relational operators that you get the result that you expected to get, and not something different, you know, because you're the you become the expert you become the one that needs to sort of translate, you know, a mathematical expression or a logical condition into a series of operators in Python, for instance, Python syntax. So I don't want to say much more than that I don't want to complicate things we'll we'll exercise this a lot more next week. But but the minimal thing you want to go into next week is is those three classes of operators, and then that the order the order precedence the order of operations that take place when you start to mix those together you have we've got to have that down for for the next unit. All right, well that's that's great I think I'll give people a chance for a question I think we have one question out there that may or may not have been answered but I just just for everyone to know. Again, thank you very much. Dr. Sack. Everyone, this is an ongoing series where we talk about a discussion of a self paced course that you can go start now on sailor.org called introduction to Python. Obviously you can go to our discourse forums all of this will be available in perpetuity. You can go to I can't believe it replete replete is the program you're using correct. Yeah, that's that that's the development it's it's online it's an online online it's it's in the chat I'll make sure it's in the description if you're watching late. The one question I had which you might have touched on because I think we got a couple minutes you said it's not really touched on in this course but someone asked a question about the bitwise the bitwise operators which is at some point someone's going to bark Simpson me and I'm going to be most as lack but someone asked if you could so we got a we got a minute or two maybe if you just want to like talk about that maybe just a little bit if people are sure so let's make believe you have a 64 bit computer okay and in a 64 so if you have 64 bit integers I'm not going to write out all 64 bits but I'll just let you know that for let's say we don't have the time so but but I'll I'll be like zero zero dot that that that that that that that you know and then all the way down to the binary representation of let's say a five and then zero zero that that that that that that all the way down to a binary representation of a seven and just like you would sort of align numbers as if you were going to add them or subtract them if I wanted to perform let's say the logical and between these two numbers they're performed bitwise bit by bit by bit by bit by bit so so just like you would add numbers down a column or subtract numbers down a column if you were sort of like if that's the algorithm that you use for addition and subtraction all you have to do basically is compare the bit representations in each position and then use that rule I talked about let's say for the and if you see two ones in a column you get a one otherwise in all of the cases you get a zero so so zero and it would zero gives you a zero one and it with one gives you a one zero and it with one gives you a zero so so you could say okay and this this only because it's not obvious if you do this if you write out the code to say five and seven like this is equal to five that's the result that you would get if you did this in python and what's taking place is a bitwise operation that's unless you understand the logical operation it's not clear why why this would be true if you were to or them then the rule for the or instead of using the and you know if you were to or them then then and you end those guys together then then you would get a one one one with a whole string of zeros afterwards so five or this is what we're predicting I'll do this in a second on the screen five or with seven is equal to seven okay so all that happens is you take those logical operations and you perform them bitwise okay for shifts you're shifting bits either to the left or to the right that's what those double arrows do they'll take these and actually uh uh if you I don't want to go we got like a minute left okay and actually as we said not covered in this specific course but anyway let's just put the brakes on here for a second so if I were to say something like you know five and seven like this um then then based upon that bit representation um in the python you know run window or whatever uh that we should go ahead and get that we should get that seven back now let's give me a five and it with seven it's giving me a seven back let's just see this is slow oh oh i'm sorry i'm sorry i'm sorry i'm sorry sorry sorry sorry it is five and seven that's true but we have to use the ampersand for the bitwise operation so five ended with that is five so so the bitwise operation so the ampersand is is the uh is the bitwise version of the and operation the the uh the up and down line uh is this so under those circumstances if you were to or them you would get a seven back so so the syntax for the bitwise operations you know they correspond to the same operations but um but they don't but they're done bitwise as opposed to um trying to like and uh or in the way that I just showed you which again you could do with it unfortunately you can do those with integers as well uh but but you got to understand that uh I'm not gonna forget I'll stop there um so but the point is is that forever for every boolean logical operation there's a an equivalent um uh operator that you can use for bitwise operations so I could do something like this I could say uh five left shift by two that's the last thing I'll do and uh if I go ahead and do this then you'll get um you'll get a 20 out because you're doing you're shifting those bits by two to the left that's what that double left means and when you shift it to the left you it basically a left shift is like multiplication by two and shift right is like a an integer division by two so so when I say shift that five by two bits it means take take all those bits and shift them over to the left and and you can demonstrate to yourself that that actually is a binary 20 which is equivalent to taking five multiplying it by two and multiplying it by two again because there would be two shifts so that is the fastest introduction to bitwise operations that I have ever given anybody on earth uh but the but the idea is that in order to use those operations you have to understand what the what the bit representations what the base two representations are for the integers for the integer representation so again if you get into floating point it's it's a it's a different ballgame altogether I'm just talking about integers right here integer representations so Eric I think that was fantastic we should probably clip that out just as like its own thing for for people for the fastest introduction that you could possibly have sure they'll be like another course you know take those three minutes so um again as always um uh Dr. Eric Sack thank you very much uh for doing this we'll be back next week 9 30 um Wednesday um 9 30 eastern time uh and everyone again you can come to uh sailor.org you find the python course there uh cs105 um all these links will be in the description thank you everyone for joining us thank you for your questions um feel free to add quest questions in the comments if we have something we need to come back to we can maybe come back to it next week at the beginning it's refresher um but thank you everyone for joining us um and again thank you thank you Eric for for being here and uh thank you everyone for being in the in the chat and people are saying very nice things right now in the chat so I thought you did a great job um everyone have a have a nice day we uh