[No audio]
Now, this conditional block happens to be
inside a function, but it can also
be outside a function such as this.
And let's say 3 greater than 1, print("Greater"), else
[Author typing]
print("Not greater"), and you'll get Greater.
What a conditional block checks is
actually, checks if this is true.
So true is actually another type in Python.
Just like integers and lists and
strings, true is another type.
So that is actually the equivalent of, if
True, print("Greater") else print("Not greater").
[Author typing]
So True is always True.
Similarly, type(3), for example, equals
to int will return True.
So that's what we are doing here as well.
However, there is another way which
is considered better in Python.
To use isinstance, isinstance(value),
and you want to check for dictionaries here, like that.
Execute and you're going to get the same output.
So isinstance(3, int) will get you the same output.
You can use either one,
but for some advanced reasons, which I'm not going to explain
right now, because it's out of the context at this point
of the course, it's better to use isinstance.
Now, you saw this example where I used if 3 is
greater than 1, and I printed out Greater and Not greater.
So we could also have these three cases.
Like 3 is greater than 1, 3 is equal
to 1, and 3 is less than 1.
In that case, if and else is
not enough, we need something else.
And I'm going to show you how we
can do that in the next video.
[Outro sound]