Common mistakes among beginning programmers

Common mistakes among beginning programmers

Keep it in mind 🧠

  1. Using mystical names for variables, such as p1 or xyz_1. If someone else reads your code, they won't have a clue of what you're talking about!

  2. Mixing two words or more in a variable, e.g., coursename. Underscores help you make your code more readable. Use them! course_name looks better.

  3. Avoiding spaces between equal signs. Spaces will also contribute to legibility, so use them. e.g., course_name="Math" is not wrong technically, but it's hard to read, and ugly (dirty code).

  4. Using a different quotation style in the same code. e.g., username = "Josh" and then location = 'Paris'. This makes you code untidy, so choose the type of quotes you want to use and be consistent. Remember: If you use double quotes, but then you need to include a cite within a string, you can insert a backlash () as an escape sequence. e.g., quote = "She said: \"I love you\", and then left."

  5. Forgetting about indentation in conditional statements. If your code doesn't work as you want, check for indentation errors. Keep in mind that a print statement outside a loop will execute regardless of whether the condition is met or not.

Â