Lesson 15 - Common Python Beginner Mistakes - Do You Make Them Too?
In the last lesson, Common Python beginner mistakes - Can you name variables?, we went through the most common beginner mistakes, when it comes to naming variables.
In today's Python tutorial, we'll slow down for a moment again and relax a bit. We'll show you what are the most common mistakes of Python programmers when using the knowledge we newly acquired, and how to avoid them. This will increase your seniority and value on the job market.
Word Of Senior Programmer
I prepared the material for today's lesson, based on 20 years of programming experience. As an editor-in-chief and also a lecturer, hundreds, maybe thousands of source codes created by the community have passed through my hands. It was not difficult to notice that most of them, although working fine, contain unnecessary errors, which are also repeated over and over again. Surprisingly, mistakes were often made not only by beginner, but also by more experienced programmers - I used to do them too.
Correct Naming of Variables
We've covered proper identifier naming in the Lesson Common Python Beginner Mistakes - Can You Name Variables?, where we also explained why we should even deal with such things.
We can now also declare lists, and naming lists is one of the biggest stumbling blocks in programming. There is a simple rule:
We always name collections in the plural form.
Again, of course, we follow the practice of naming a variable based on what's stored in the variable. And when there are multiple things, it should logically be plural.
Let's look at some wrong and correct examples of list declarations:
...End of the preview...
You've come here and that's great! We believe that the first lessons showed you something new and useful
Do you want to continue the course? Go to the premium section.
- Unlimited and permanent access to individual lessons.
- High quality IT knowledge.
- Skills to help you get your dream and well-paid job.
Requested article covers this content:
In this Python lesson, we'll go through good practices regarding collections naming, bool expressions, DRY etc. and how they are frequently done wrong.
You gain credits by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.