1. Step1: download and install python
We have already seen in a previous tutorial (How To Install Python), if you have not yet installed python, please refer to this tutorial.
2. Step2: Download and install an IDE of your choice
I recommend the Wing IDE: nice and very easy to use.
The Wing IDE includes three versions:
- Wing Pro: paid
- Wing Personal: free
- Wing 101: very simplified for beginners
We recommend the free version Wing Perso. After downloading and installing your Python Wing IDE, launch it from the start menu:
Before thinking about coding now, you will first have to think about configuring your IDE. To do this, click on the IDE Wing configuration tool:
At this time, a new window named: Project Properties opens. Then select the Custom option and then the Browse button and then select the Python interpreter executable or leave by default if you have added the path to the Python interpreter in the environment variables:
3. Step3: creation of a first Python program
From Wing's File menu, select New:
A new tabbed editor pane appears. Type the code below:
s = "This is my first program in Python!" print(s)
In this first program:
- we create a new variable of string type named s (we also say it string characters).
- print(s): this command, prints on the screen, the value of the string s .
Then, before running the program, we should save it. To save a file, you can go to the File menu and select Save, or use the disk icon on the toolbar or just press Ctrl+S.
A Save dialog box appears. Finally, click Save.
Now all you have to do is to run your first program:
To run it, make sure the script you want to run is the active tab (right now we should only have one tab, which is simple). Then click the green button in the top toolbar:
You should see the output in the shell, like in the screenshot below:
Congratulations !
Younes Derfoufi
CRMEF OUJDA