Which Text Editor Should You Choose?
This is the kind of question that’ll get you into a war on Reddit. Do some quiet research before asking online.
If you’re comfortable using vi or vim, they’re perfectly fine. Beginners don’t usually start with vi these days, but you may run into environments where it’s your only option.
More advanced programmers are going to need a full IDE to wrangle large projects. Unless you’re already experienced with IDEs, just use a simple text editor for now. For a typical extremely detailed StackOverflow type answer, see this:
https://stackoverflow.com/questions/81584/what-ide-to-use-for-python
If you’re not familiar with StackOverflow yet, remember this site! Etiquette is a big deal here, so be careful of your reputation points.
For a more chatty, friendly Quora discussion, see here:
https://www.quora.com/What-is-the-best-IDE-for-Python
And if you prefer video, this one is great for illustrating the points of difference (and argument). Especially note the comments:
https://www.youtube.com/watch?v=qThV8oLKfWU
But if you really want just a simple IDE that lets you edit and run scripts, IDLE is probably the easiest option. Go here to find the simple commands to install IDLE in Linux:
http://elearning.wsldp.com/pcmagazine/install-python-idle-editor-centos-7/
Now you’re ready to follow this video on using both the python shell and idle commands:
https://www.youtube.com/watch?v=kXbpB5_ywDw
Someday you’ll want something more advanced. If you haven’t already run into it, you’re going to find automatic code completion a magical blessing. In the Microsoft IDE world it’s called IntelliSense, and you’ll get it using MS’s Visual Studio Code IDE, which can be installed on Linux, Mac and Windows. Other environments like Eclipse offer some nice Python-coding features and plugins too, so don’t think MS is the only way to go.
Finally, the most popular tool for Python development, according to recent research, is PyCharm. See https://www.jetbrains.com/research/python-developers-survey-2017/, and https://www.jetbrains.com/pycharm/ to find downloads.
We’re Going to Use the Python Shell and Nano
The python shell is already installed on any Linux system that has Python. (I’m using lowercase “python” to indicate the command, while the proper noun “Python” gets an initial cap). On most other OSs you’ll need to install a Python package.
Assuming Python is installed, all you have to do is open a terminal and type:
python
This puts you at a command line where you can enter Python commands. It’s great for one-liners, but not very useful for building scripts.
Instead, we’ll run Nano from the command line:
nano myscript.py
You’ll find it handy to have two terminal windows open, one for Nano and the other to run your code.