1 00:00:00,000 --> 00:00:04,000 This is now the conclusion section of this Python course, 2 00:00:04,001 --> 00:00:09,000 and I want to give you a few best practices I've learned from 3 00:00:09,001 --> 00:00:12,000 my own experience before you continue your Python journey. 4 00:00:12,001 --> 00:00:17,000 Those will help you write better code and solve problems in a more efficient way. 5 00:00:17,001 --> 00:00:19,000 Let's start. 6 00:00:19,001 --> 00:00:22,000 First, try to respect the naming conventions. 7 00:00:22,001 --> 00:00:28,000 For example, use underscore to separate words in a variable name, 8 00:00:28,001 --> 00:00:31,000 but use capitalized words for classes names. 9 00:00:31,001 --> 00:00:34,000 Doing this will force you to be consistent, 10 00:00:34,001 --> 00:00:38,000 it will make your life easier when reading code from 11 00:00:38,001 --> 00:00:40,000 others, who are also respecting those conventions, 12 00:00:40,001 --> 00:00:46,000 and it will make other people's lives easier when reading your own code. 13 00:00:46,001 --> 00:00:51,000 Well, the conventions are simply here to 14 00:00:51,001 --> 00:00:53,000 facilitate collaboration, so use them properly. 15 00:00:53,001 --> 00:00:58,000 Also, give meaningful names to your variables, functions, classes, etc. 16 00:00:58,001 --> 00:01:03,000 If you need to read a temperature, then name the variable temperature, 17 00:01:03,001 --> 00:01:09,000 and not tprt or just tpt for example, just to gain a few characters 18 00:01:09,001 --> 00:01:14,000 and add a lot of confusion about what your variable means. 19 00:01:14,001 --> 00:01:17,000 Then be careful with the indentation. 20 00:01:17,001 --> 00:01:22,000 Python relies on indentation to make sense of the code you write, 21 00:01:22,001 --> 00:01:26,000 so always double check that what you want to write in 22 00:01:26,001 --> 00:01:29,000 a block of code is actually inside that block of code, 23 00:01:29,001 --> 00:01:34,000 and not somewhere else because the indentation is not correct. 24 00:01:34,001 --> 00:01:38,000 Another best practice is to try to not repeat yourself. 25 00:01:38,001 --> 00:01:44,000 Use loops, functions, and if needed classes whenever you can. 26 00:01:44,001 --> 00:01:47,000 Create building blocks and reuse them 27 00:01:47,001 --> 00:01:51,000 instead of writing the same code all over again. 28 00:01:51,001 --> 00:01:57,000 Then, and this is more general but super important, keep things simple. 29 00:01:57,001 --> 00:01:59,000 It's not because your application is complex 30 00:01:59,001 --> 00:02:02,000 that your code should be overcomplicated. 31 00:02:02,001 --> 00:02:07,000 Think before you write code and write just what you need. 32 00:02:07,001 --> 00:02:10,000 You don't create the foundation for a castle 33 00:02:10,001 --> 00:02:13,000 when what you really need is a wood cabin, right? 34 00:02:13,001 --> 00:02:15,000 So don't over-optimize your code 35 00:02:15,001 --> 00:02:20,000 and actually don't optimize at all before you really need to. 36 00:02:20,001 --> 00:02:23,000 Keep things simple when you code, 37 00:02:23,001 --> 00:02:29,000 go to the point and focus on solving the problems you need to solve and no more. 38 00:02:29,001 --> 00:02:31,000 And the last advice I'm going to give you now 39 00:02:31,001 --> 00:02:36,000 is to search on Google and actually practice searching on Google. 40 00:02:36,001 --> 00:02:39,000 This, I can tell you, is a real skill 41 00:02:39,001 --> 00:02:44,000 that unfortunately is completely underestimated by many people. 42 00:02:44,001 --> 00:02:46,000 Being good at programming doesn't mean 43 00:02:46,001 --> 00:02:50,000 you know all the functions of all languages by heart. 44 00:02:50,001 --> 00:02:55,000 Being good at programming is about being good at solving real problems using code. 45 00:02:55,001 --> 00:03:00,000 And a part of that is searching on Google whenever you don't know something. 46 00:03:00,001 --> 00:03:04,000 In fact, if you ask any developer out there, including me, 47 00:03:04,001 --> 00:03:07,000 what they mostly do in a day, they are probably going 48 00:03:07,001 --> 00:03:10,000 to tell you, "Well, I searched stuff on Google." 49 00:03:10,001 --> 00:03:15,000 You don't need to know everything, but you need to know how to search for information 50 00:03:15,001 --> 00:03:20,000 and how to apply that information to solve a given problem. 51 00:03:20,001 --> 00:03:24,000 This is the real value of a great developer.