‫Welcome back.
‫Let's talk about our first data type.
‫And you know what?
‫Let's do two at the same time.
‫We have int and floats.
‫INT stands for integer, as you can see here.
‫And float stands for a floating point number.
‫Hmm.
‫Let's explore that.
‫First, let's start off with integer.
‫An integer is, well, a number.
‫Three or four or five.
‫These are all integers.
‫In a programming language, you can use integers to do mathematical operations, for example, two plus
‫four.
‫If I run this well, nothing gets printed because again, we have to perform some action on these data
‫types.
‫And one action that we've learned so far is this idea of printing.
‫And we print something by calling the print keyword with the brackets.
‫So the brackets is almost like saying, hey, perform this action on these data types.
‫And if we run this.
‫We get six right here.
‫Awesome.
‫So not only are we using print, but we're also using the plus sign to perform an action to add the
‫two data types together.
‫And as you can imagine, we can do most mathematical operations.
‫The basic ones we can do negative, we can do, let's say, two times four.
‫And then we can also do two divided by four.
‫And if I click run here.
‫All right.
‫It looks like everything is working.
‫We've added, we've subtracted, we've multiplied.
‫And then we've also divided.
‫Now, here's the interesting part.
‫Up until now, we've used what we call integers.
‫That is, these are whole numbers.
‫There's no decimal places.
‫They're just, well, integers.
‫And a neat trick that I can do here is I can actually say.
‫Hey, what's the type of two plus four?
‫If I click run here.
‫All right, let's let's decipher what just happened.
‫I've taught you another action that we can perform, which is something called type, which tells us,
‫Hey, what data type is this?
‫And just like in math, we go bracket by bracket.
‫So the first part, Python says, hey, what's two plus four?
‫Well, that's going to be six.
‫And it's going to say, hey, what's the type of sex?
‫Well, the type of six that's an integer.
‫So it's going to say class.
‫And we don't have to worry about the class keyword for now.
‫That's something that we'll talk about later.
‫But we see here that we're using int for integer and then finally after this gets evaluated by Python,
‫we print out whatever this does, which is class int.
‫Now check this out.
‫Let's do the same for all these ones as well.
‫So we're going to say type here.
‫Type.
‫Here.
‫And then type.
‫Here.
‫And if this syntax is intimidating, don't worry.
‫This is something that you get used to.
‫If this is your first programming language, it is not going to be easy because, well, if it was easy,
‫then everybody would be doing it.
‫So hang in there.
‫Trust me, as you practice more, this is going to start making more and more sense.
‫Now, before I click Run, what do you think of the output of each one of these lines are?
‫Ready.
‫Give it a guess and let's click Run.
‫All right, we got it.
‫For six.
‫We have negative two here, which is also an integer.
‫We have eight here, which again is also an integer.
‫But then we have float.
‫Because two divided by four is 0.5.
‫Hmm.
‫What is that?
‫Well, remember, we are talking about two data types here.
‫We're talking about int and float.
‫And float is what we call a floating point number.
‫A floating point number is simply a number with a decimal point.
‫In our case, this is 0.5.
‫So it's a floating point number.
‫So if we write a number, let's say we'll do print type and then I'll say 0.00001.
‫What do you think we'll get?
‫Well, we would get a float.
‫If I do 5.0001 again, we'll get a float.
‫What about the number zero?
‫If I click Run.
‫I get an ENT because well, there's no decimal points.
‫Why do we need to make this distinction in programming and specifically in Python?
‫Well, it's because a float takes up actually a lot more space in memory than an integer.
‫Right.
‫Because remember this number, the number six, this needs to get stored in memory on our machine.
‫And remember that machines don't really understand this.
‫They understand zeros and one.
‫And they store this number in something called a binary or binary numbers, which is zeros and ones.
‫Now, the problem is when you have a decimal places like zero point or let's do 10.56, it's hard to
‫represent that in a binary number, zeros and ones, because of this point.
‫So a floating point number essentially stores these numbers in two different location, one for the
‫ten and one for 56.
‫Now.
‫We don't need to get technical here, but that's the idea.
‫The idea is that we need more memory to store a number like this than a number like this.
‫Now the topic of floating point numbers is really, really interesting and I'll link to a resource.
‫But the best way to learn more about floating points.
‫Again, it's not super important that you know the technical details, but if you go to floating point
‫number Python.
‫Again, you want to make sure that you go to the documentation for version three.
‫And you can actually learn about floating point arithmetic and these official documentation by Python
‫are always a good tool for you to use whenever you get confused about something or you want to get a
‫little bit more extra detail.
‫But let's get back to the topic at hand.
‫Both int and float are used for well numbers.
‫Right.
‫And Python is going to automatically format the type to whatever.
‫Well make sense.
‫For example if in here.
‫I do.
‫20 plus 1.1.
‫One is a integer.
‫The other one is a floating point number.
‫But when I click Run here.
‫Automatically Python is going to convert it to float.
‫Let's remove these here so that we don't get confused by them.
‫So if I run this, we see that this whole expression is converted into, well, a float.
‫Now, if I do, let's say 9.9 here.
‫Which will equal to 11 and I click run.
‫These two floats add up to while still a floating point number because if I remove the type from here
‫and I click run.
‫It gives me the result.
‫11.0.
‫It keeps the floating point numbers.
‫All right.
‫But at the end of the day, what we care about is that that Python works the way we expect it to.
‫That is, we can do mathematical operations.
‫As a matter of fact, we can do a few other things as well.
‫There's also this idea of the double multiply.
‫So this means to the power of so two to the power of two.
‫Well, that's going to equal four.
‫To do.
‫The power of three is going to equal eight.
‫We also have the double divide.
‫That is, we can do two divided by four.
‫But then we used to slashes here.
‫If I click run here.
‫I get zero.
‫This actually returns an integer.
‫Round it down.
‫If I do.
‫Three divided by four.
‫I get zero, but if I do five divided by four.
‫I get one?
‫This gets rounded down to a integer.
‫Finally, the last operator that we're going to learn about is called modulo.
‫And it looks something like this.
‫If I do five modulo, which is the percent sine.
‫Divided by four or modulo four.
‫If I run this.
‫I get one?
‫Modulo is used to represent what's the remainder of this division.
‫So if I divide five by four, the remainder of this division will be one.
‫If I do six divided by four with modulo and I run, I get two.
‫Two is the remainder.
‫Oh four.
‫All right.
‫Let's take a break and learn a little bit more about these numbers in the next video.
‫Bye bye.