1 00:00:00,000 --> 00:00:01,570 [No audio] 2 00:00:01,571 --> 00:00:04,356 Now, this conditional block happens to be 3 00:00:04,357 --> 00:00:06,932 inside a function, but it can also 4 00:00:06,933 --> 00:00:09,988 be outside a function such as this. 5 00:00:09,989 --> 00:00:20,821 And let's say 3 greater than 1, print("Greater"), else 6 00:00:20,822 --> 00:00:22,900 [Author typing] 7 00:00:22,901 --> 00:00:30,338 print("Not greater"), and you'll get Greater. 8 00:00:30,339 --> 00:00:32,716 What a conditional block checks is 9 00:00:32,717 --> 00:00:36,476 actually, checks if this is true. 10 00:00:36,477 --> 00:00:39,782 So true is actually another type in Python. 11 00:00:39,783 --> 00:00:41,792 Just like integers and lists and 12 00:00:41,793 --> 00:00:44,590 strings, true is another type. 13 00:00:44,591 --> 00:00:48,432 So that is actually the equivalent of, if 14 00:00:48,433 --> 00:01:00,190 True, print("Greater") else print("Not greater"). 15 00:01:00,191 --> 00:01:02,966 [Author typing] 16 00:01:02,966 --> 00:01:05,379 So True is always True. 17 00:01:05,990 --> 00:01:10,078 Similarly, type(3), for example, equals 18 00:01:10,079 --> 00:01:12,088 to int will return True. 19 00:01:12,089 --> 00:01:14,552 So that's what we are doing here as well. 20 00:01:14,553 --> 00:01:16,732 However, there is another way which 21 00:01:16,733 --> 00:01:18,630 is considered better in Python. 22 00:01:19,690 --> 00:01:23,260 To use isinstance, isinstance(value), 23 00:01:23,261 --> 00:01:26,840 and you want to check for dictionaries here, like that. 24 00:01:28,270 --> 00:01:31,462 Execute and you're going to get the same output. 25 00:01:31,463 --> 00:01:38,278 So isinstance(3, int) will get you the same output. 26 00:01:38,279 --> 00:01:39,680 You can use either one, 27 00:01:39,681 --> 00:01:43,684 but for some advanced reasons, which I'm not going to explain 28 00:01:43,685 --> 00:01:47,092 right now, because it's out of the context at this point 29 00:01:47,093 --> 00:01:50,506 of the course, it's better to use isinstance. 30 00:01:50,507 --> 00:01:55,380 Now, you saw this example where I used if 3 is 31 00:01:55,381 --> 00:02:00,186 greater than 1, and I printed out Greater and Not greater. 32 00:02:00,187 --> 00:02:03,482 So we could also have these three cases. 33 00:02:03,483 --> 00:02:07,522 Like 3 is greater than 1, 3 is equal 34 00:02:07,523 --> 00:02:10,220 to 1, and 3 is less than 1. 35 00:02:10,221 --> 00:02:12,188 In that case, if and else is 36 00:02:12,189 --> 00:02:14,348 not enough, we need something else. 37 00:02:14,349 --> 00:02:15,788 And I'm going to show you how we 38 00:02:15,789 --> 00:02:17,480 can do that in the next video. 39 00:02:17,481 --> 00:02:21,033 [Outro sound]