1 00:00:00,780 --> 00:00:02,460 Instructor: I wanna add a quick note 2 00:00:02,460 --> 00:00:07,460 about this spacing that we see in this code. 3 00:00:07,800 --> 00:00:11,100 Now, this isn't just for Python. 4 00:00:11,100 --> 00:00:14,370 In other languages, you'll always see this. 5 00:00:14,370 --> 00:00:17,820 You're not going to see that every single line of code 6 00:00:17,820 --> 00:00:21,873 always starts, as well, in the first space. 7 00:00:23,310 --> 00:00:25,890 Different languages will use this differently, 8 00:00:25,890 --> 00:00:28,260 but in order to organize code, 9 00:00:28,260 --> 00:00:31,053 usually you'll see some indentation like this. 10 00:00:32,520 --> 00:00:36,180 Now, Python, however, is unique 11 00:00:36,180 --> 00:00:40,330 because the indentation and spaces that we see here 12 00:00:41,670 --> 00:00:44,197 makes the interpreter see it and say, 13 00:00:44,197 --> 00:00:46,380 "Hey, this means something." 14 00:00:46,380 --> 00:00:49,320 The interpreter would actually see the space 15 00:00:49,320 --> 00:00:51,570 and say, "Because there's space here, 16 00:00:51,570 --> 00:00:55,350 I know that this is part of the if block." 17 00:00:55,350 --> 00:00:58,530 In other languages, like JavaScript, 18 00:00:58,530 --> 00:01:00,510 well you have something similar, 19 00:01:00,510 --> 00:01:03,090 but usually you'll have an if statement 20 00:01:03,090 --> 00:01:07,170 and then some condition followed by, 21 00:01:07,170 --> 00:01:08,670 make sure I spell condition right, 22 00:01:08,670 --> 00:01:11,460 followed by something like a curly brace. 23 00:01:11,460 --> 00:01:14,130 And in here, whatever is in here, 24 00:01:14,130 --> 00:01:16,230 you can see that I still get the space 25 00:01:16,230 --> 00:01:18,090 and I can do whatever I want. 26 00:01:18,090 --> 00:01:21,090 But, JavaScript interpreter 27 00:01:21,090 --> 00:01:22,980 doesn't really care that there's spaces. 28 00:01:22,980 --> 00:01:27,980 If I want, I could write my code just on one line like this 29 00:01:28,680 --> 00:01:31,323 and it's still valid in JavaScript code. 30 00:01:32,190 --> 00:01:36,630 So people usually do the spacing more for style purposes. 31 00:01:36,630 --> 00:01:38,880 Python, on the other hand, 32 00:01:38,880 --> 00:01:41,730 is not just for styling that we do this 33 00:01:41,730 --> 00:01:43,350 but because the interpreter 34 00:01:43,350 --> 00:01:46,380 actually finds meaning in the spaces, 35 00:01:46,380 --> 00:01:49,890 which is actually one of the big selling point with Python. 36 00:01:49,890 --> 00:01:51,060 It's very clean. 37 00:01:51,060 --> 00:01:54,570 There's no extra stuff here that makes it difficult. 38 00:01:54,570 --> 00:01:56,730 I mean, it's just English, right? 39 00:01:56,730 --> 00:02:01,650 If is_old and if is_licensed, then print this. 40 00:02:01,650 --> 00:02:05,070 It's just really nice to read and really clean. 41 00:02:05,070 --> 00:02:08,220 Now, if you notice here, my editor, 42 00:02:08,220 --> 00:02:10,889 and we're gonna talk about editors and IDs 43 00:02:10,889 --> 00:02:12,570 in an upcoming section, 44 00:02:12,570 --> 00:02:15,510 but if you are using the proper tools, 45 00:02:15,510 --> 00:02:17,973 this automatically is created for you. 46 00:02:18,900 --> 00:02:20,880 Now, in the programming world, 47 00:02:20,880 --> 00:02:24,360 there's this debate about tabs and spaces, 48 00:02:24,360 --> 00:02:26,160 and we're not going to get into it. 49 00:02:26,160 --> 00:02:28,770 It's frankly a little bit silly. 50 00:02:28,770 --> 00:02:30,810 That is some people prefer to, 51 00:02:30,810 --> 00:02:33,510 here if they want to create a space, 52 00:02:33,510 --> 00:02:38,510 they might use spaces or they might use tabs. 53 00:02:38,640 --> 00:02:40,740 At the end of the day, with Python, 54 00:02:40,740 --> 00:02:45,720 the rule is we can use spaces, you can use the tab, 55 00:02:45,720 --> 00:02:47,760 but the idea that if you use spaces, 56 00:02:47,760 --> 00:02:50,640 you usually use four spaces. 57 00:02:50,640 --> 00:02:52,710 It's just a standard. 58 00:02:52,710 --> 00:02:57,710 Now, if you notice here, I actually don't have four spaces. 59 00:02:58,770 --> 00:03:01,410 It's two spaces here. 60 00:03:01,410 --> 00:03:03,570 And that is because up until now, well, 61 00:03:03,570 --> 00:03:07,770 I've just been following along whatever this editor gives me 62 00:03:07,770 --> 00:03:11,640 but if you look over here, there's an auto format button. 63 00:03:11,640 --> 00:03:15,940 If I click on this, it automatically formats my code 64 00:03:17,040 --> 00:03:18,870 into the appropriate format. 65 00:03:18,870 --> 00:03:23,730 And you see right over here that I now have for spaces. 66 00:03:23,730 --> 00:03:26,340 But you see that the code still works. 67 00:03:26,340 --> 00:03:29,520 Again, it's because at the end of the day, 68 00:03:29,520 --> 00:03:32,310 the important part is that there's a distinction 69 00:03:32,310 --> 00:03:33,720 between hierarchies. 70 00:03:33,720 --> 00:03:37,080 That is the top and then maybe the children. 71 00:03:37,080 --> 00:03:41,010 But the interpreter itself is going to notice these spaces. 72 00:03:41,010 --> 00:03:43,080 So you do have to be careful 73 00:03:43,080 --> 00:03:48,000 because based on where this print is, 74 00:03:48,000 --> 00:03:53,000 as soon as I add a tab in here and I click run, 75 00:03:55,560 --> 00:03:57,780 well, I get is_old and is_licensed. 76 00:03:57,780 --> 00:04:02,767 But as soon as one of this is false and I click run, 77 00:04:04,050 --> 00:04:09,050 you see that okok runs only if this condition fails. 78 00:04:09,210 --> 00:04:12,243 Again, if previously both of these were true, 79 00:04:13,410 --> 00:04:15,510 I only get the first line printed. 80 00:04:15,510 --> 00:04:20,510 So that little space here changes the outcome of my program. 81 00:04:21,269 --> 00:04:23,760 So you have to really be careful with this 82 00:04:23,760 --> 00:04:26,700 and luckily your editor, or where you code, 83 00:04:26,700 --> 00:04:28,530 is going to help you out with this. 84 00:04:28,530 --> 00:04:30,210 But it is a gotcha 85 00:04:30,210 --> 00:04:33,480 that if you're just starting out, you wanna be mindful of. 86 00:04:33,480 --> 00:04:36,330 All right, no more debates about spaces and tabs. 87 00:04:36,330 --> 00:04:37,860 I'll see you in the next video. 88 00:04:37,860 --> 00:04:38,693 Bye-bye.