TripleTen experts
Aaron Gallant
Aaron Gallant
Data Science Curriculum Lead
TripleTen.Coding Bootcamps

IT career tips

Sign up for our newsletter to get future-proof advice from tech industry experts.

Stay in touch
TripleTen.Coding Bootcamps

TechStart podcast

Explore the realities of changing careers and getting into tech.

Listen now

Novice programmers often encounter numerous mistakes along the way. Pinpointing it within code can be a time-consuming and arduous task, and many beginners find themselves spending several hours on it.

It’s frustrating. To write the correct code on the first try is impossible, but making fewer mistakes is entirely within reach. That’s why we’ve collected the most common mistakes coding newbies should watch out for. Be assured, it will save you a couple of hours when writing code.

Ignoring the spaces

You can’t write interesting, useful, and understandable text without spaces. The same rule applies to coding. With spaces, programmers format the code to make it look better and easier for other programmers to read. Programmers use spaces to show what belongs to what and how everything is connected.

The Python code with correct spaces.

That is what this Python code might look like if you put spaces and tabs correctly. We see two commands: the loop that runs sequentially and a message about the completed loop. But the system will break down if you put extra spaces. The loop in Python is a construct that allows you to repeatedly perform a block of code.

In some programming languages, notably Python, spaces play the role of punctuation marks. In regular text, missing punctuation causes confusion; in coding the command will not work the way we intended. 

Loops in Python differ only in extra spaces in the third line. But the result is tremendously different. 

In the example above, we forgot that the message «The loop is over» is another command and made extra four spaces, as it’s needed in Python. Because of this, the message became a part of the loop, so we see it after each number.

Sometimes a code without spaces will not work. 

For example, if you write code in Python but don't make any space there, the computer won't even run the program and will give an error right away.

As you can see, we did not put any space in lines. We destroyed the logic of the code. That’s why the program didn’t understand what we had planned.

On the other hand, in most other languages there is no such problem. You can put as many tabs and spaces as you want in your code. An example of this is JavaScript. But it’s not that simple. Instead of spaces and tabs, there are curly brackets.

Not closing brackets

Sometimes you can get carried away and not close the round bracket when the logical block is over. Such code will not work, and the program will generate an error.

Let’s go back to the example of loops in Python. It’s enough not to put just one parenthesis; the code won’t start. The program will show the error and indicate where it is.

Syntax error in Python code because of a missing bracket.

The solution is hidden in a basic rule that always works. There should be as many open round brackets as closed ones.

In Python, you cannot do without parentheses in the code even if you call a function without arguments. A function is a block of code that performs a specific task. It allows you to bring your program into smaller, more manageable pieces. So functions take input values called arguments, perform operations using provided arguments, and can optionally return a result.

As a rule, arguments in function should be added in round brackets. But sometimes you need to call a function without arguments. It works with entire parameters. The common mistake is calling this function without round brackets.

The only thing you will see on your computer screen is «Invalid syntax». 
And when you will call this function, you also need to add brackets. Otherwise, the computer will ignore the call and move on to the next command.
As you can see in the screenshot, the computer ignored the function and performed another command. 
It’s enough to add round brackets, and the computer stops ignoring our requests and performs the loop.

Using non-matching quotes

But even if you never forgot spaces or even brackets, you were bound to waste hours because of non-matching quotes.  

It may seem unimportant. To be beginner-friendly, Python and JavaScript both support single and double quotes. However, you will get an error if you use different opening and closing quotes. You have to be consistent with which one you’re using!

The Python code with non-matching quotes.

Do you see where the mistake is? This mistake is easy to make if you write code quickly and inattentively. In the fourth line, we specified the message in different quotes. 

So we broke the syntax of the code. As a result, the program did not understand what we asked it to do in this line. 

This code will work as we have planned if we will use the same quotes at the beginning and end of the line.

Now the program read our request correctly and ran it. 

How not to make mistakes in code

Those were only the most common mistakes, but it is by no means a complete list. 

Some mistakes can be quite challenging to identify by yourself. You might find yourself watching hours of YouTube videos in search of a solution, but yield no luck. (Moreover, this could happen quite often!)

Good news: you can improve your coding skills with professional support at TripleTen's Software Engineering Bootcamp. Experienced code reviewers will help you write perfectly clean code in any programming language.

And with your new skill set, you can work as a full-stack developer and enjoy a  median salary of $75,000 per year. (87% of students find a tech job within the first six months!)

Discover the way to challenge-free code and relish a smoother, more efficient coding experience.

IT career tips

Sign up for our newsletter to get future-proof advice from tech industry experts.

Stay in touch

TechStart podcast

Explore the realities of changing careers and getting into tech.

Listen now
No items found.