Python – Editor


Python documentation:

More tools to learn Python:

There are different ways to program in Python.

The shell

The most basic one is the shell/Terminal. Type:

$ python3

And something like this should appear:

Python 3.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

The problem with Python in the shell is that you have to type and retype a lot. That is why you better use and editor, like Bluefish, Kate, Notepad, [Microsoft Visual Code]….

The shell is useful to quickly test functions or small snippets of code, especially handy when you’re working on larger scripts.

Python editor

The Python editor allows you to write scripts.

Ideally you create a folder for your project on your Desktop. You create a new file in the editor (like Atom). You save it in the new folder, specifying the extension .py. Make sure your script has a significant name. With something like ‘’ you might run into trouble.

Once you have your script saved, you open a terminal and move to your folder:

$ cd Desktop/yourfolder

Note: on Windows the terminal is called cmd and the commands can be slightly different:

Once you’re in the folder, you can check whether your script is there:

$ ls (Note: for Windows this is: dir)

Once you’re in the folder, you can execute your script:

$ python (Note: in Windows there is no need to mention python)

Some operating systems still have Python 2.7 as a default. It then helps to run your script as follows:

$ python3

You now will see your script act in the terminal. You can easily adapt the code in the file and run it again!