LibreOffice does not currently ship with a built-in Python editor like the Basic IDE. I never use Tools → Macros → Organize Macros → Python because it has very limited functionality.
Instead, download and install the APSO extension. APSO is not required to write Python macros, but it puts scripts in the correct locations, which is helpful for beginners and can even be convenient for experts. APSO can also embed Python scripts in LibreOffice documents for you, which would otherwise require unzipping and zipping the document as well as configuring XML files.
You will need to choose a text editor, which IMHO is good especially for Python because you can choose an editor that helps with spaces. The Basic IDE is limited in many ways. Personally, I use GVim, and if there are any spacing inconsistencies, :retab
automatically fixes them. Notepad++ is another option I would recommend if you want something simpler and are using Windows (which you aren’t, according to your question, so just ignore that suggestion). PyCharm can also be used but must be set up carefully to get it to work with LibreOffice.
Python macros can also be run without APSO just like Basic macros, by going to Tools → Macros → Run Macro. Or, Python macros can be run from a command line on a listening instance of LibreOffice. See Interface-oriented programming in OpenOffice / LibreOffice : automate your office tasks with Python Macros.