 Hello again, everyone. This is Brian, we're going to continue our journey into Python three. This video, we're going to cover numbers, the number data type, specifically the int, the float, and the complex data types. And we're going to cover some basic numerical operations, for example, addition, subtraction, things like that. Whatever IDE you're using, go ahead and make a blank file. I've got mine titled Python three dash four dot py. The name's not important at this point, you just need a blank file to start with. Last video, we talked about the bool. This video, we're going to talk about numbers, I know everybody loves numbers. So let's go ahead and start off with the integer type. And we're going to make a simple variable here, and I'm gonna call this I val. And let's give it a value of 34 really doesn't matter what value we give it, though, say print. And we're just going to print something out here. There we go. And let's call this I val equals. And we just want to print that value out. Just to see what this looks like. They've run this is pretty basic, you pretty much guess what's going to do it's gonna say the I val equals 34. Very, very simple, not super hard to wrap your head around. Now we're going to take this to the magic of copy and paste here. And we're going to make a float. Float sounds really good right about now, like a root beer float or something like that. But we're talking about numbers, not root beer floats, unfortunately. So we're going to make a floating point value. And it's going to be 3.14 save run on the surface, what we're doing looks very rudimentary. But under the hood, Python is doing all of this workforce, we don't have to worry about what's actually going on. So for example, there's a fundamental difference between an integer and a floating point number. There's a lot of precision that happens in the background, and we don't have to even think about that. Python takes care of it for us. I'm going to import the sys module. And what this is going to do is allow us to work with other people's code. And we're going to talk about that in depth in another video. But just right now, take a huge leap of faith that we're using someone else's code. This is actually part of Python, but we have to import it. It's a little confusing. Again, we'll talk about it in depth in another video. Usually it's at the top of the file, we're just going to put it right here. But we want to be able to get some extra information. So I'm going to say sys dot float info. And let's go ahead and copy and paste some notes in here just so we can see what's going on. I'm going to grab this and voila, put that right there. That is the official Python documents. If you want to go out and look at it and see exactly what's going on, we can run it and see under the hood, this is what Python's really keeping track of when it talks about floats. So we have the system float info. You have a max, which is a really, really, really large number. And you can also have a max exp and you could dive into all this stuff. Now, if you're into numbers and math, you probably know what all this is, but us mere mortals usually don't care. Basically, if you have a number that has a decimal point, you're going to use a float. Otherwise, you'll use an int. Now we're going to talk about another one. And it's called complex. And it is, well, complex. Now, when I say complex, actually, Python makes it super simple to work with, but the data type itself under the hood, you guessed it, is not super simple. It is complex. And it looks something like this, a complex number is made up of two numbers, a real number, and an imaginary number kind of sounds a little messed up. But let's take a look. So I say C val equals, and let's say three plus six J giant leap of faith that I know what I'm doing there. What is that really going to do? What it's going to make that complex number. And let's grab the name here. C val C val. And let's print it out. It doesn't really look like we did a whole lot. It's just saying C val equals three plus six J exactly what I typed. Let's split this apart here. What we're going to do is show an alternate way of creating a complex value. And you can do this with float knit, but it really drives the point home with complex. So I'm going to say complex. And notice how it wants the float and the image. Let's go ahead and give them both. So I'm going to say five three. And let's go ahead and I'm going to just through the magic copy and paste here. Grab this. Let's say C val is that. Now I want to print out the real. And we want to go ahead and grab this copy, paste. And we want the second part of that number just so we can see what it is. Go ahead and save and run. So now you can see the complex number is made up of two parts. And that actually would probably be better if I made it the way it was supposed to be. There we go. Real and imaginary two different parts. That's what makes that a complex number. So the fundamental point we're driving home here is that numbers are very fundamental and simple data types, but they can get very complex very quickly. Python strips a lot of that complexity out. If you're coming from Python two or another language, you're going to note this seems overly simplistic and it is by design. Python three pretty much revamped the number system and did away with a lot of the old headaches. So it's super simple. General rule of thumb. No decimal point use an int decimal point use a float. If you need something else use complex and there are others that we will cover in future videos, but this should get us going for now. Okay, let's talk about basic numerical operations. Now don't worry, we're not going to get super complex. We're talking basics. Python can do some really complex stuff. For example, you can do calc trig advanced algebra pretty much any type of math you can imagine. Python's actually used in scientific computations. And it can do things like artificial intelligence. We are starting at the basics. So we need to talk about the basics. I'm going to say x equals three, which is an integer. Now I'm going to print this out. And I'm going to just grab the old print function here, save us just a smidge of time. Nothing super fancy about that. But what we're going to do now is we're going to make another variable. Let's call it y. And we're going to say y is equal to x plus three. So what have we really done here? We've done basic addition. Let's go ahead and grab this. And let's call this add. And this is going to be y. And that's going to be our fundamental pattern here where we're going to do something. And then we're going to just display the results. And I'm going to say add that way we know what we're doing, save and run. And sure enough, add is equal to six, because x is three. And we're adding three three plus three is six. Again, fundamentals. Now, we're going to start speeding this up, because I think you're probably smart enough to understand basic math. And we're just going to grab this. And you guessed it, start plowing through this. So if we can add, we can also subtract. Let's go ahead and say we want to minus one run. And you can see three minus one is actually two. So that works exactly the way you would expect it to. Let's go ahead and multiply. And we're going to say, hmm, this is something you really can't do very easily in other languages, Python makes it just beautifully simple. So we're going to say 6.846. Doesn't really matter what number we do, just as long as we have that. Now, if you look, x is an int. But what are we doing? We're multiplying it by a float. So what's going to happen under the hood here is Python is going to determine what the in value type actually is. Is it going to become an integer? Or is it become a float? You notice how it's not really telling us when we hover over intelligence. And that's because the interpreter hasn't done the work yet, so it simply doesn't know. So let's call this multiply and the end result is 20.538. So that is a floating point number. Now we're going to do some division. Grab this. And we want to say x is going to be divided by 0.5. Again, it's doing all of that hard number crunching in the background. What it's actually doing is called casting. And when you think of casting, think of like a wizard waving a magic wand, converting something from one data type to another, that is happening automatically for us, we don't have to think about it. Now it's not always going to happen automatically for us. But in this specific case, it is and it's super, super convenient. Don't worry, we're going to talk about casting in depth in another video right now. We're still at the fundamentals. And let's play around a little bit. We're going to make a power up. So we're going to say that is the power. So three, the power of two is nine. And one more just to play around here. Let's do the remainder. I think this is called the modulus operator. And we're going to get this. You don't know what this is. This is kind of like the opposite. I shouldn't say the opposite. It's kind of like taking division and getting the remainder of what's out of that value. It's kind of weird. So let's take a look here. So 0.5. So what we're doing here is we're starting with X is three. And we're getting their remainder of 2.5, which is actually 0.5. Very simple, very easy to use. So the fundamental concept we're trying to drive home here is there are some number data types in float and complex, and you can do some basic numerical operations. Python makes those numerical operations very simple, because it handles all the complexity under the hood for us, and we don't even have to think about it. I hope you enjoyed this video. You can find the source code out on github.com. If you need additional help, myself and thousands of other developers are hanging out in the Voidromes Facebook group. This is a large group with lots of developers, and we talk about everything technology related, not just the technology that you just watched. And if you want official training, I do develop courses out on udemy.com. This is official classroom style training. If you go out there and the course you're looking for is just simply not there, drop me a note. I mean, they're working on it, or I will actually develop it. I will put a link down below for all three of those. And as always, help me help you smash that like and subscribe button. The more popular these videos become, the more I'll create and publish out on YouTube. Thank you for watching.