Instructor: Welcome back.
This is a quick, optional video
that, well, with something that you probably
won't use, but I want you to just know that it's out there.
And that is there's actually an extra data type
that I didn't talk about.
And it's called complex.
And, as the name suggests,
it's pretty complex.
However, a complex number, again,
is a number that is a third type.
Instead of int and float,
we also have this type for numbers.
Now, the reason I'm not really teaching complex
is that you'll only use this
if you're doing something really, really complex math.
Most of the time, you'll never use it.
I personally have never used it.
But it is good to know
that it exists.
It's the equivalent to a real number
and you can read about complex numbers if you want.
But again, that's something that you don't need to worry
99.9% of the time.
Another thing I wanna talk to you about
is this idea that these integers and floats
get stored, such as five, in memory as binary.
That is, as binary numbers, ones and zeroes.
And there's actually an action or a function
that we can use in Python called bin for binary.
And you can see that a bin
returns the binary representation of an integer.
So it's going to return whatever the binary version
of five is.
If I click run here, well, I have to print.
Remember.
So let's print
and click run
and I get the binary representation.
Now, instead of all zeroes and ones,
there's also this idea of B.
And that is what Python uses underneath the hood
to say, "Hey, when I see this number
"with zero B, that's a binary number."
But if I google binary number 5,
I see that the binary number for five
is 101, which, again, that's what we see here.
So, that's really cool, really interesting
just to know that it exists.
By the way, just for fun,
let's say that we wanna return this into a decimal.
Let's say we're the computer
and we just retrieve this binary number.
I can do int and then wrap this like this
in single or double quotes.
And then, with the int, I can also say,
"Hey, I want this return to a number that is base 10,"
which is what us humans use.
So if I actually do print here and click run,
well, actually, we have to do base two here, right?
Because what we're saying is,
"Hey, this number is base two"
and convert it to integer.
And base two number is, well, zeroes and one.
It's a binary number.
So if I click run here,
look at that, I get five.
So in your head, you can think of it this way:
when we store a number like five,
an integer like five, when a computer retrieves that number,
let's say we're doing some addition,
well, it's going to grab this from memory.
It's going to say, "Well, this is a binary number
"and I'm going to convert it into integer."
Very, very cool.
Now, the reason I taught this here,
you won't see this a lot in beginner courses
and especially so early in the course,
but I think it's an important principle,
although you might not get tested on this, ever.
For you to just understand how things are working
underneath the hood, I believe is an important thing
for you to do in order to become a great developer.
So hopefully, this doesn't confuse you too much.
I'll see you in the next video, bye bye.