Do You Only Create Classes for Code You Meant to Repeat?

Learning Python starts fun, till you get to object-oriented programming. After a fun-filled introduction involving cats and dogs, the so called lesson on OOP ends abruptly. You are left in a confused state. How do I use OOP in my own code? When should I use it? In this article, I’ll address a smaller part of the question. Do you only use OOP to avoid repeating code? The answer is a resounding no. The primary reason for using OOP is

Continue Reading

How to Use Jupyter Notebook inside VS Code

Jupyter notebooks are not just for data scientists and machine learning engineers. Even as a backend developer, you could test out your algorithms interactively inside a Jupyter notebook. It’s helpful when you want to take a TDD-like approach but still need your ideas to somewhat materialize first. 1. Setup Python in VS Code In a freshly installed version of VS Code, you still need to setup Python. If you’re unsure how to do it, here’s a guide that I wrote.

Continue Reading

14 Must Have VS Code Extensions for Python Developers

Use these extensions to give a boost to your VS Code development experience. 1. Python The core language extension that enables syntax highlighting, virtual environments, and intellisense support. Click here for more details. 2. Visual Studio IntelliCode AI-assisted intellisene for Python. Click here for more details. 3. Better Comments Give your comments a facelift by styling them differently depending on the type of information they convey. Click here for more details. 4. Kite Autocomplete Another AI-based autocomplete solution. You need

Continue Reading

Fix for Linting Not Working on VS Code

Once you install the Python plugin, you might observe that linting does not work. Consider the file below where I’ve written gibberish, but no errors are shown: 1. Install PyLint The problem is that you probably don’t have PyLint installed in your virtual environment. Open a new terminal by typing Ctrl + Shift + ~ (the character right below Esc). VS Code should automatically switch to your virtual environment. Type pip install pylint. 2. Select PyLint as the Linter Press

Continue Reading

Setting Up Python on VS Code

Once you have VS Code installed, you just need to install a plugin called “Python by Microsoft”: 1. Open the Extension Tab of VS Code This should open up the extensions panel. This is where you’ll search for and install all the extensions. 2. Type “Python” in the Search Box & Install the Extension by Microsoft Once you type “Python” in the search box, the very first extension would most likely be the one that you’re looking for. Make sure

Continue Reading

Create your first “complex” solo project without getting stuck

Usually, after going through courses or books like Python Crash Course or Automate the Boring Stuff, you might get stuck. You’re able to follow tutorials, but not able to create your own project from start to finish. I’ll quickly teach you how to create a small project that “looks complex,” but is pretty simple. This is so that you don’t get demoralized by looking at cool projects that you’re not able to create. The reason is not that you’re not

Continue Reading

Learn how to think like a programmer and improve your problem solving

When you start learning programming (in something like Python), you first learn all the syntax and basic constructs of the language. These are your if, for, while, functions, classes and the likes. You’d then encounter sample applications like finding factorial, calculating compound interest, etc. However, given a problem, you’re not able to come to a solution on your own. At this point, you’ll be able to perfectly follow someone else’s solution. But you have a hard time constructing a solution

Continue Reading

Create a line chart with axis ticks and legends using Matplotlib

Matplotlib can be an annoying library to learn. Here’s how to create a simple line chart with custom axis ticks and legends. Here’s the code to do all that (you can do this in a Jupyter notebook): And here’s what you would see as the output: Let’s walk through the code To set custom axis ticks, you need to use plt.subplots instead of plt.figure. The subplots function returns both the figure and the main axis. Next, we call the plot

Continue Reading

How should I start if I already know another language?

If you want to learn Python, but already know/or are proficient in another language, then the traditional resources that others use might not be fully relevant to you. Regardless of your background, I’d always suggest you to take the “Litmus Test for Learning Python.“ These are the rules that you should follow: Stick to just books or other written material. You could choose interactive courses, but try avoiding video courses. Jump directly into learning the Python Standard Library. These are

Continue Reading

How to setup Python in your system, regardless of what other courses say

There are multiple ways of setting up Python depending on your platform. Moreover, the different people seem to prefer different “package managers” (used to add libraries to you project). It is unnecessarily confusing when you’re just starting out. You’ll get a chance to be opinionated later, but that’s not a wise choice right now. To install Python, just use Anaconda 3: https://www.anaconda.com/distribution/ It has installers for all major platforms (Linux, Windows, OSX). You’re successful if you’re able to create a

Continue Reading

Site Footer

Sliding Sidebar