$ ipython  
Python 2.7.9 (default, Mar  1 2015, 18:22:53)  
Type "copyright", "credits" or "license" for more information.

IPython 2.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: 2+2
Out[1]: 4

In [2]: 3*4
Out[2]: 12

In [3]: 2**100
Out[3]: 1267650600228229401496703205376L

In [4]: 12/10
Out[4]: 1
                                                                                            
In [5]: 12/10.0                                                                        
Out[5]: 1.2                                                                        
                                                                              
In [6]: a = 3                                                               
                                                                
In [7]: a                                                       
Out[7]: 3                                                     

In [8]: 4*a
Out[8]: 12

In [9]: a = a+1

In [10]: a += 1

In [11]: a
Out[11]: 5

In [12]: a++
 File "<ipython-input-12-bdceb1bc89e4>", line 1
   a++
      ^
SyntaxError: invalid syntax


In [13]: def suma(a, b):
  ....:     return a+b
  ....:  

In [14]: suma(10, 20)
Out[14]: 30

In [15]: suma(3, .1415926535897)
Out[15]: 3.1415926535897

In [16]: def fibo(n):
  ....:     a, b = 0, 1
  ....:     while n:
  ....:         n -= 1
  ....:         a, b = b, a+b
  ....:     return a
  ....:  

In [17]: fibo(0)
Out[17]: 0

In [18]: fibo(1)
Out[18]: 1

In [19]: fibo(500)
Out[19]: 1394232245616978801397243828704072839500702565876973
07264108962948325571622863290691557658876222521294125L

In [20]: lista = [1, 2, 3, 4]

In [21]: lista
Out[21]: [1, 2, 3, 4]

In [22]: if lista:
  ....:     print 'lista jest niepusta'
  ....: else:
  ....:     print 'lista jest pusta'
  ....:  
lista jest niepusta

In [23]: for x in lista:
  ....:     print x, x*x
  ....:  
1 1
2 4
3 9
4 16

In [24]: for x in 1, 2, 3, 4:
  ....:     print x*x
  ....:  
1
4
9
16

In [25]: range(10)
Out[25]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In [26]: range(1, 10+1)
Out[26]: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

In [27]: range(1, 11, 2)
Out[27]: [1, 3, 5, 7, 9]

In [28]: range(70, -1, -7)
Out[28]: [70, 63, 56, 49, 42, 35, 28, 21, 14, 7, 0]

In [29]: help(range)


In [30]: for x in range(15):
  ....:     print fibo(x)
  ....:  
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377

In [31]: l = []

In [32]: l.append(1)

In [33]: l
Out[33]: [1]

In [34]: l.append(2)

In [35]: l
Out[35]: [1, 2]

In [36]: l += [3, 4, 5]

In [37]: l
Out[37]: [1, 2, 3, 4, 5]

In [38]: len(l)
Out[38]: 5

In [39]: def wypisz_podz_3_7(n):
  ....:     for i in range(n+1):
  ....:         if i%3==0 or i%7==0:
  ....:             print i
  ....:  

In [40]: wypisz_podz_3_7(25)
0
3
6
7
9
12
14
15
18
21
24

In [41]: def lista_podz_3_7(n):
  ....:     wynik = []
  ....:     for i in range(n+1):
  ....:         if i%3==0 or i%7==0:
  ....:             wynik.append(i)
  ....:     return wynik
  ....:  

In [42]: lis
list            list-cards.0    list-cards.1    lista        
  lista_podz_3_7   

In [42]: lista
lista           lista_podz_3_7   

In [42]: lista_podz_3_7(25)
Out[42]: [0, 3, 6, 7, 9, 12, 14, 15, 18, 21, 24]

In [43]: import math

In [44]: math.
math.acos       math.atanh      math.e          math.factoria
l  math.hypot      math.log10      math.sin
math.acosh      math.ceil       math.erf        math.floor   
  math.isinf      math.log1p      math.sinh
math.asin       math.copysign   math.erfc       math.fmod    
  math.isnan      math.modf       math.sqrt
math.asinh      math.cos        math.exp        math.frexp   
  math.ldexp      math.pi         math.tan
math.atan       math.cosh       math.expm1      math.fsum    
  math.lgamma     math.pow        math.tanh
math.atan2      math.degrees    math.fabs       math.gamma   
  math.log        math.radians    math.trunc

In [44]: math.sqrt(2)
Out[44]: 1.4142135623730951

In [45]: math.sqrt
Out[45]: <function math.sqrt>

In [46]: help(math.sqrt)


In [47]: help(math)      


In [48]: def rozwiazania_trojmianu(a,b,c):
  ....:     delta = b*b-4.0*a*c
  ....:     if delta < 0.0:
  ....:         return []
  ....:     elif delta == 0.0:
  ....:         return [-b/(2.0*a)]
  ....:     else:
  ....:         return [  (-b-math.sqrt(delta))/(2.0*a),
  ....:                   (-b+math.sqrt(delta))/(2.0*a),
  ....:                ]
  ....:      

In [50]: rozwiazania_trojmianu(1,2,1)
Out[50]: [-1.0]

In [51]: rozwiazania_trojmianu(1,20,1)
Out[51]: [-19.9498743710662, -0.05012562893380057]

In [52]: rozwiazania_trojmianu(1,1,1)  
Out[52]: []

In [54]: x1, x2 = rozwiazania_trojmianu(1,20,1)

In [55]: x1
Out[55]: -19.9498743710662

In [56]: x2
Out[56]: -0.05012562893380057

In [57]: print x1
-19.9498743711

In [58]: print '%.2f' % x1
-19.95

In [59]: print 'rozwiazania trojmianu to: %.2f, %.2f' % x1, x
2
-------------------------------------------------------------
--------------                                                
TypeError                                 Traceback (most rec
ent call last)
<ipython-input-59-db641cacd9e8> in <module>()
----> 1 print 'rozwiazania trojmianu to: %.2f, %.2f' % x1, x2

TypeError: not enough arguments for format string

In [60]: print 'rozwiazania trojmianu to: %.2f, %.2f' % (x1,
x2)
rozwiazania trojmianu to: -19.95, -0.05

In [61]: lista
Out[61]: [1, 2, 3, 4]

In [62]: lista.append(720)

In [63]: lista
Out[63]: [1, 2, 3, 4, 720]

In [64]: del lista[1]

In [65]: lista
Out[65]: [1, 3, 4, 720]

In [66]: krotka = (1,2,3)

In [67]: krotka.append(4)
-------------------------------------------------------------
--------------                                                
AttributeError                            Traceback (most rec
ent call last)
<ipython-input-67-0a2dd0e5acf5> in <module>()
----> 1 krotka.append(4)

AttributeError: 'tuple' object has no attribute 'append'

In [68]: del krotka[1]
-------------------------------------------------------------
--------------                                                
TypeError                                 Traceback (most rec
ent call last)
<ipython-input-68-e79e5b3c9952> in <module>()
----> 1 del krotka[1]

TypeError: 'tuple' object doesn't support item deletion

In [69]: tuple()
Out[69]: ()

In [70]: ()
Out[70]: ()

In [71]: tuple(lista)
Out[71]: (1, 3, 4, 720)

In [72]: list()
Out[72]: []

In [73]: []
Out[73]: []

In [74]: list(krotka)
Out[74]: [1, 2, 3]

In [75]: l = list(krotka)

In [76]: l.append(111)

In [77]: l
Out[77]: [1, 2, 3, 111]