1 00:00:00,430 --> 00:00:03,310 Now when it comes to naming your variables, 2 00:00:03,610 --> 00:00:06,580 you can pretty much call it whatever it is you want. 3 00:00:07,270 --> 00:00:09,010 So instead of calling this name, 4 00:00:09,370 --> 00:00:14,370 I could have just called it n and I could have called this l and as long as I'm 5 00:00:14,920 --> 00:00:15,790 consistent. 6 00:00:15,880 --> 00:00:20,880 So if I wanted to get the length of N then I would have to change this as well. 7 00:00:21,940 --> 00:00:25,960 And if I wanted to print out L then I have to change this as well. 8 00:00:26,590 --> 00:00:29,260 But there's a couple of rules that you should probably follow. 9 00:00:29,350 --> 00:00:34,350 And the most important one is to make your code readable. Because if you come 10 00:00:35,800 --> 00:00:38,830 back to this in six months, 12 months, 11 00:00:39,280 --> 00:00:42,730 N and L is not going to have a lot of meaning for you. 12 00:00:43,150 --> 00:00:46,450 So try to make sure that it actually makes sense to you. 13 00:00:47,590 --> 00:00:48,670 And if you want to, 14 00:00:48,670 --> 00:00:52,630 you can actually have multiple words in the name of your variable. 15 00:00:52,960 --> 00:00:55,900 So for example, if you wanted to call this username, 16 00:00:56,260 --> 00:01:00,610 then you would write the word user and then you would separate each of the words 17 00:01:00,820 --> 00:01:05,680 with an underscore. But you can't have a space in between. 18 00:01:05,710 --> 00:01:10,030 This is not valid code and if you try to run it, you'll get a syntax error. 19 00:01:10,840 --> 00:01:15,840 So the name of the variable has to be one single unit and in order to separate 20 00:01:16,810 --> 00:01:19,300 words in Python, we use the underscore. 21 00:01:20,080 --> 00:01:23,500 Now if you want to use numbers in the name of your variable, 22 00:01:23,500 --> 00:01:25,870 you can. So for example, length1, 23 00:01:25,870 --> 00:01:30,870 length2. But they can't be at the beginning of the name of the variables. 24 00:01:31,630 --> 00:01:35,200 You can't say 1length or 3length. 25 00:01:35,530 --> 00:01:39,850 That will generate a syntax error as well. Finally, 26 00:01:40,360 --> 00:01:43,720 there's certain privileged words that we use, for example, 27 00:01:43,720 --> 00:01:47,560 the names of our functions like print and input. 28 00:01:48,040 --> 00:01:53,040 And it's usually good practice to not use them as the names of your variables 29 00:01:53,530 --> 00:01:57,430 because you can see that syntax highlighting gets messed up because it thinks 30 00:01:57,670 --> 00:02:00,130 that is actually input function you're trying to create. 31 00:02:00,460 --> 00:02:04,330 And even though often when you run your app, it might not have any issues, 32 00:02:04,540 --> 00:02:07,600 this is really bad practice because it's very confusing. 33 00:02:08,680 --> 00:02:12,430 So try to make sure that all the names of your variables get highlighted, 34 00:02:12,670 --> 00:02:15,760 like the other variables in the same color. Now, 35 00:02:15,790 --> 00:02:20,170 the final thing to remember is that if you decide to call your variable this 36 00:02:20,170 --> 00:02:25,170 particular name, n-a-m-e, and at a later point you make a typo and you spell it 37 00:02:26,380 --> 00:02:31,090 wrong, so maybe instead of name you said nama, 38 00:02:31,780 --> 00:02:36,640 this is not going to work and when you run your code you'll get what's called a 39 00:02:36,670 --> 00:02:41,670 name error because it says this name is not defined. And the idea is that you 40 00:02:43,390 --> 00:02:48,390 would look at where the error is, line 2, print nama and you'll see, 41 00:02:49,090 --> 00:02:51,880 Oh that's not right. It's meant to be spelled n-a- 42 00:02:52,090 --> 00:02:57,090 m-e. So you'll have to go and fix it in order for your code to work. 43 00:02:58,000 --> 00:03:02,800 Now remember that this is not because Python is doing any sort of spell-checking 44 00:03:02,800 --> 00:03:06,730 for you. It's like, Oh, that's not how you spell name. No. In fact, 45 00:03:06,850 --> 00:03:11,850 if you decided to call this nama and you, later on, used it as name, 46 00:03:13,090 --> 00:03:16,000 there's no problems, there's no issues, no errors,. 47 00:03:16,690 --> 00:03:18,670 As long as it's consistent, 48 00:03:19,060 --> 00:03:23,830 this is the name that's associated with this piece of data. Later on, 49 00:03:23,830 --> 00:03:28,780 when you want to use this piece of data, you use this name to refer to it. 50 00:03:29,180 --> 00:03:32,290 And as long as these two spellings are identical, 51 00:03:32,500 --> 00:03:34,660 then the computer doesn't care at all. 52 00:03:35,230 --> 00:03:38,290 So when you get a name error in your code, 53 00:03:38,350 --> 00:03:43,350 you now know it's probably because you've misspelled or mistyped one of the 54 00:03:43,570 --> 00:03:47,950 variable names somewhere in your code. Now in the next lesson, 55 00:03:48,040 --> 00:03:52,510 I prepared a quiz for you where you'll get to select which variable names are 56 00:03:52,540 --> 00:03:55,390 valid and which ones are not good practice. 57 00:03:55,720 --> 00:03:58,060 Have a go at that over on the next lesson.