Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:01,860 --> 00:00:08,080
Now this conditional block happens to be a inside a function, but it can also be outside a function
1
2
00:00:08,830 --> 00:00:10,200
such as this.
2
3
00:00:10,210 --> 00:00:12,660
And let's say
3
4
00:00:12,670 --> 00:00:19,520
3 > 1 print greater.
4
5
00:00:20,140 --> 00:00:24,570
Else print
5
6
00:00:25,310 --> 00:00:30,380
not greater and you'll get greater.
6
7
00:00:30,380 --> 00:00:34,970
What a conditional block checks is actually checks
7
8
00:00:34,970 --> 00:00:42,290
if this is true, so True it's actually another type in Python just like integers, and lists, and strings
8
9
00:00:42,790 --> 00:00:54,280
true is another type, so that is actually the equivalent of if true print greater.
9
10
00:00:54,770 --> 00:00:59,910
Else print not greater.
10
11
00:01:03,260 --> 00:01:06,110
So true is always true.
11
12
00:01:06,120 --> 00:01:12,100
Similarly type 3 for example equals to int will return true.
12
13
00:01:12,150 --> 00:01:14,220
So that's what we are doing here as well.
13
14
00:01:14,670 --> 00:01:20,850
However there is another way which is considered better in Python to use
14
15
00:01:20,850 --> 00:01:29,670
isinstance, isinstance, value and you want to check for dictionaries here like that, executes and you're
15
16
00:01:29,670 --> 00:01:31,510
going to get the same output.
16
17
00:01:31,590 --> 00:01:38,230
So isinstance(3, int) will get you the same output.
17
18
00:01:38,340 --> 00:01:44,770
You can use either one but for some advanced reasons which I'm not going to explain right now because
18
19
00:01:44,770 --> 00:01:50,880
it's out of the context at this point of the course is better to use isinstance.
19
20
00:01:50,970 --> 00:02:00,300
You saw this example where I used if 3 is greater than 1 and I printed out great and not greater.
20
21
00:02:00,300 --> 00:02:06,490
So we could also have these three cases like three is greater than one.
21
22
00:02:06,510 --> 00:02:10,380
Three is equal to one and three is less than one.
22
23
00:02:10,410 --> 00:02:16,080
In that case if and else is not enough, we need something else, and I'm going to show you all we can do
23
24
00:02:16,080 --> 00:02:17,190
that in the next video.
2365
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.