Python Introduction

Python Programming Language

Python is:

Running Python Programs

  1. From the command line: python
  2. From the interpreter: Type python to start.
  3. As scripts: Add the following line in the beginning of the file: #!/usr/local/bin/python

Small Examples

  • Hello World
>>> print "Hello, World!"
Hello, World!
  • Hello World with a variable
>>> def hello (what):
...     text = "Hello, " + what + "!"
...     print text
>>> hello ("World")
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.