Python codes can be executed in three ways:
Writing Python code in a text editor and saving it with a .py extension. This file can then be executed in the Command Prompt.
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.
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.
print “HELLO WORLD”
Example 2: Printing “HELLO WORLD” in python using Interactive Mode.
Example 3: Printing “HELLO WORLD” in python using Interactive Mode and using a Variable.