
An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9). $ chmod +x test.py # This is to make file executableĪ Python identifier is a name used to identify a variable, function, class, module or other object.


Now, try to run this program as follows − We assume that you have Python interpreter available in /usr/bin directory. Let us try another way to execute a Python script. Now, let's try to run this program as follows − We assume that you have Python interpreter path set in PATH variable. Type the following source code in a test.py file − Let us write a simple Python program in a script which is simple text file. When the script is finished, the interpreter is no longer active. We can invoke the Python interpreter with a script parameter which begins the execution of the script and continues until the script is finished. However in Python version 3.x, this produces the following result − If you are running older version of Python, like Python 2.4.x, then you would need to use print statement without parenthesis as in print "Hello, World!". Let's type the following text at the Python prompt and press the Enter − Here > denotes a Python Command Prompt where you can type your commands. Type "help", "copyright", "credits" or "license" for more information.

We can invoke a Python interpreter from command line by typing python at the command prompt as following − Let us execute a Python "Hello, World!" Programs in different modes of programming. However, there are some definite differences between the languages. The Python Programming Language Syntax has many similarities to Perl, C, and Java Programming Languages. The Python syntax defines a set of rules that are used to create Python statements while writing a Python Program.
