In our previous chapter, we have strongly recommended you to ditch IDLE and use some code-editor and terminal(MacOS/Linux) or Powershell(Windows) to write and execute your python script. In this chapter we will tell you how to do that.
First and foremost for the purpose of this tutorial, create a new directory say ‘python_for_beginners’ at your desired location.
$ mkdir python_for_beginners
Now let’s create a new file in this folder and name it ‘hello_world.py’. Open that file in the editor you are using and write down the following code and save it:-
Now open your terminal and cd to the ‘python_for_beginners’ folder. Alternatively on MacOS you can right click on the folder and select ‘New Terminal at Folder’. To run the script you will have to write:-
$ python hello_world.py
and you will get the output like this:-
Note- Some of the users probably on MacOS might need to use python3 instead of python to run the script in Python 3 version, though I will be using python in my tutorial, but I urge you to check you version and use python3 or python accordingly.
If you have any question till now, feel free to ask in the comment section.