~jurgis-pralgauskis/intro-to-code/trunk

« back to all changes in this revision

Viewing changes to intro-to-code-4web/tutorials/intro.2.py.txt

  • Committer: jurgis
  • Date: 2009-02-18 23:07:20 UTC
  • Revision ID: jurgis@baltix-20090218230720-2i9hc4k2dvdj54e0
little rework of tutorial text files -- preparing for parralel show of several languages examples -- now py vs pas ;) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
= Multiline examples =
2
 
 
3
 
#<<< :menu
4
 
 
5
 
== Loops ==
6
 
 
7
 
>>> for x in range(50):
8
 
...     if  10 < x/2 < 20:
9
 
...         print x 
10
 
 
11
 
== Classes ==
12
 
 
13
 
>>> class Figure():
14
 
...     def __init__(self, nodes):
15
 
...         self.nodes = nodes
16
 
...         pass
17
 
...
18
 
 
19
 
>>> class Rectangle(Figure):
20
 
...     def __init__(self, nodes, a, b):
21
 
...         self.a = a
22
 
...         self.b = b
23
 
...         super.__init__(nodes)
24
 
...         pass
25
 
...     
26
 
...     def square():
27
 
...         return a*b
28