First Steps With Python

Starting Pytthon Interpreter

After installation, the python interpreter lives in the installed directory. On Windows machines, the Python installation is usually placed in C:\PythonXX, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:
set path=%path%;C:\pythonXX
You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window. Typing "python" in the command line will invoke the interpreter in immediate mode. We can directly type in Python expressions and press enter to get the output.
Writing the First Python Program
The classic first program is "Hello, World!" Let’s adhere to tradition. Type in the following and press Enter:
How to run first python program in windows
Congratulations!! You have written your first program in Python.

Python Scripting mode

Scripting mode is used to execute Python program written in a file such as Notepad or any other text editor. Such a file is called a script. Scripts can be saved to disk for future use. Python scripts have the extension .py , meaning that the filename ends with .py. For example: "myFirstProg.py". Open a text editor (Notepad) and type in the following program exactly as written:
print ("Hello World!")

Save this file as "myFirstProg.py".

To execute this file in script mode we simply write "python myFirstProg.py" at the command prompt.

You should see the line Hello World! as output.


Make Your First Python Program
The print() is a function that tells the system to perform an action. We know it is a function because it uses parentheses. print() tells Python interpreter to display or output whatever we put in the parentheses. By default, this will output to the current terminal window . Congratulations! You have written the "Hello, World!" program in Scripting mod also.