Execute Python

Execute Python:

Python codes can be executed in three ways:

Script Mode:

Writing Python code in a text editor and saving it with a .py extension. This file can then be executed in the Command Prompt.

Interactive Mode:

Writing Python code in a Python interactive shell. This method is useful for immediate testing of code with no stress of writing and saving the code in a file. This method is suitable only for testing purpose and for small codes.

IDE Mode:

Writing Python code in an Integrated Development Environment or IDE, such as Thonny, Pycharm, Netbeans or Eclipse. This method is suitable for managing large numbers of Python files simultaneously.

 

Example 1: Printing “HELLO WORLD” in python using Script Mode.

//pythonexample.py

print “HELLO WORLD”

Output: