cheny0y0 / python-0.9-tutorial

Tutorial of Python 0.9.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to Python 0.9 tutorial

Install Python 0.9

  1. Download the archive, or by command wget https://www.python.org/ftp/python/src/Python-0.9.1.tar.gz.
  2. Extract it to a directory.
  3. Change directory into “src”.
  4. Type make and execute it. If you do not install “make”, please install it.
  5. Type ./python to run the interactive shell.
    You can add this directory to $PATH.

You can also view the “doc” directory for more info.

Basic Syntax of Python 0.9

>>> # Print text
>>> print 'Hello world'
Hello world
>>> # “for” statement
>>> for i in range(10): print i
... 
0
1
2
3
4
5
6
7
8
9
>>> # “while” statement
>>> a = 0
>>> while a < 5 :
...     a = a + 1
...     print a
... 
1
2
3
4
5
>>> # “if” statement
>>> if 2 + 3 = 5: print '2 plus 3 is equal to 5'
... 
2 plus 3 is equal to 5

About

Tutorial of Python 0.9.