Back to articles list Articles
6 minutes read

Finished Python Basics Course? Code on Your Computer

Online Python courses help you acquire basic knowledge of working with Python. But how do you retain what you've learned and start writing Python code on your own?

Nowadays, there are plenty of e-learning platforms for programming languages like Python. With these platforms, you can learn the fundamentals of the Python language: syntax, basic functions, and programming best practices.

On platforms like LearnPython.com, for example, you don't need others tools to work through the content and can get your hands dirty with a language in a sandbox environment. But once the training wheels come off, you'll need to know how to work with the language on your own computer.

If you've already acquired basic Python skills, your next step is to write and execute scripts on your own computer. In this article, we'll cover everything you need to know about writing Python code on your own and why you need a proper editor for programming.

What Do I Need to Start Writing Python Code On My Own Computer?

When run, Python code is fed to an interpreter, a special program that executes one instruction at a time. You can think of an interpreter as a translator—it reads your code in one language (Python) and reduces it to equivalent statements in a language that your machine can understand and execute.

To execute Python scripts on your own computer, you'll need to download the latest release of Python and install it on your machine. This installation will include the Python interpreter by default.

Done? Awesome! You're now ready to write scripts on your own computer. (Seriously, this is all that you need.) But using an editor will help you immensely with getting started. Let's take a look at some popular text editors and see if they're appropriate for Python programming.

Is a Text Processor Like MS Word Good for Writing Python Code?

Programming newbies are often unsure where they should write their code. If you think you can write code in a text processor like Microsoft Word, I'm afraid I have some bad news—you can't. Mainly, this is because Microsoft Word formats the text you write by default; it adds additional information that you can't see to a document, rendering it unusable by programs like the Python interpreter.

Instead, to write code, you need an editor that doesn't format the text in any way and treats it as plain text. Such an editor may offer syntax highlighting, beautiful colors, and other visual features, but it doesn't actually format the underlying text and how it's represented on your computer.

To better understand the difference, try this: Write a Python script in a Word document, and then try opening that Word document in a text editor like Notepad. You'll find that there are strange symbols and unrecognizable gibberish—naturally, the Python interpreter won't be able to make sense of this. (In fact, Word won't even allow you to save a file with a .py extension.)

But if you write your code in a true text editor, and you later try to open the script with another editor, the actual code will not have changed. And that's exactly what you want.

Simple Text Editors: Is Notepad Good for Python Beginners?

Notepad is just about as basic as text editors get, and some people suggest you start coding in it (though that doesn't mean that you should)! This kind of editor allows you write plain text, which as we mentioned above is good for programming.

Some text editors offer syntax highlighting and suggestions, but a simple text editor like Notepad doesn't offer anything beyond a stripped-down black-and-white interface.

Unfortunately, there are three notable downsides to using Notepad for Python:

  • It's not ideal for quickly running or debugging code. Every time you want to run your Python script, you'll have to use a command-line terminal like bash, cmd, or PowerShell. And if you want to debug your code, you'll need to know how to use command-line debugging utilities.
  • It lacks intelligent feedback and syntax highlighting. Good editors will give suggestions as soon as you begin typing to help save you time and avoid bugs. They'll also repeatedly scan your code to ensure it doesn't have any syntax errors, and they'll use colors to help distinguish different elements of your code from one another. In Notepad, everything is black and white. This means it's easier to make mistakes in Notepad than in another editor.
  • It's not ideal for projects with multiple files. If your Python program depends on multiple scripts, you won't get any nice file management interface with tabs and a directory tree to help you navigate your scripts. Instead, you'll have to open each file in a separate window.

One benefit to using Notepad is that it forces you to learn how more sophisticated editors are actually able to run your code. It also forces you to familiarize yourself with command-line tools and environments, which many professional programmers use in their daily work.

Dataframe

Integrated Development Environments: Writing Python Code Efficiently

More commonly, professional programmers use integrated development environments (IDEs) to write their code Why? Well, as we mentioned above, a simple text editor like Notepad only has one main feature: it allows you to write plain text.

With an IDE, you can do that and much more. First, an IDE integrates various tools that are helpful for writing and running code. For example, with a good IDE, you won't have to launch a terminal, navigate to your project directory, and then invoke the Python interpreter to run your code. The IDE will take care of it all for you with built-in tools. Some will even present you with a dedicated output window.

Moreover, most IDEs feature debuggers that help you track your code's execution line by line and identify problems (if any). This is much more efficient than reading your code and trying to find a potentially elusive bug. And with code highlighting, you'll be able to more easily identify different parts of your code, like keywords and variable names, so that the file isn't as disorienting to look at.

Another main feature that beginners benefit from is codebase management; this helps you go to the next file in your project without having to open multiple application windows. You'll also be able to take advantage of auto-completion and suggestion features to write code more quickly and keep things formatted properly.

Overall, IDEs are perfect for beginners and advanced programmers alike. While simple text editors like Notepad may seem "hardcore," they're really not. And when you consider how much time is wasted writing code with a simple text editor, you'll find it's not worth it at all.

Wrap-up: Getting Started with Python

Taking an online Python course gives you the hang of Python basics and can be the beginning of your new, exciting programming journey. But to retain and improve your knowledge, you need to practice what you've learned. Fortunately, you can do just that by downloading Python and choosing the right coding environment for your needs.

Want to stay on top of everything Python? Follow our blog for more articles in this series. In the next post, I'll share the most famous Python IDEs and give you an overview of them.