Introduction to the Python Interpreter
Go To: Start>Programs>Python27>IDLE
(Integrated DeveLopment Environment)
The Python Shell or Interpreter (Above Center) is where you can "Interact" with Python.
The Python File Editor (Above Right) is where you can create your Python Scripts (Get to that Later).
Go to the Python Shell and Type the Following In (one line at a time):
Notice: The Python Interpreter will Immediately Output your Print Statement.
Alert:
Python 3 changed the Print Statement to a function()
So we have to Adapt to that.
THE ABOVE WAS A VERY SHORT INTRODUCTION TO THE PYTHON INTERPRETER
It is VERY Helpful for Testing Code and Syntax.
Running Your First Python Script
First... Create a Directory somewhere called "Python_Scripts".
In the Python Shell... Go To: File>New File
You will see the Python file Editor open.
Next, Save your first Script...
In the Python file Editor... Go To: File>Save
Navigate to your "Python_Scripts" Directory.
Save your file with the name "My_First_Script.py".
Go to the Python file Editor and Type the Following:
Note: Python Requires a four(4) Space Indent inside of If Statements, For Loops, etc.
The __name__ == '__main__' statement is not Required for this Example,
But... It is often used to "separate" and allow importing of your useful Functions.
Now, Run the Script...
Go To: Run>Run Module (or Press F5)
The Script will Run with the Output Displayed in the Python Shell.
THE ABOVE WAS A VERY SHORT EXAMPLE OF CREATING AND RUNNING A PYTHON SCRIPT
Much More to Learn...
Integers, Floats, Characters, Strings and Formatting
Tuples,
Lists, and
Dictionaries
If Statements, For Loops, While Loops, etc.
Functions and Classes
File I/O
Exception Handling
And More...