First Python Program
- Python comes preinstalled with an integrated development environment(IDE) known as IDLE
- But we can install any IDE of our choice, for this we will be using sublime text
- Click https://www.sublimetext.com/download to download sublime text
- Double click on the downloaded executable files to install it.
Python IDLE
Python IDLE (Integration Development Environment) is the Python IDE that comes with the Python distribution. Python IDLE is also known as interactive interpreter. It has a number of features such as text editor with syntax highlighting, smart indent and auto completion, etc., that help you work with Python quickly.
The following illustrates how to launch Python IDLE and write the Python code inside the text editor:
Launch Python IDLE
New Python Shell window will display as follows:
Enter the following code and press Enter, the message “Hello World” will display in the next line.
On Sublime Text
Once you have installed it then you have to set the path of python installation directory in environment variable. If your path is already set then you can skip this part otherwise follow this link Setting Path . As we have already set the path so i am skipping it.
Test A simple Program
Now we will see execution of python program on Sublime Text 3. For this what we have to do is that
- First of all open your sublime editor.
- Create a new file by following steps File->New File or by pressing ctrl+N .
- Then save this file as yourfilename.py . The extension must be .py .
- Then write your code.
Here i am taking a simple Hello World program
Running The Code
- Go to Tool option on menu bar and then click on Build System and inside this select Python option.
- Then go to Tool option and click on Build option that will execute your code. So now, on running the above code we will get the following output
Comments
Post a Comment