In [10]:
def my_func(name):
    print("hello "+ name )

my_func("gediz")


hello gediz

In [8]:
4+5


Out[8]:
9

In [29]:
x=3
a="gorillas"
b=True
shopping_list=[]
shopping_list.append(x)
shopping_list.append(a)
shopping_list.append(b)
shopping_list
shopping_list.remove(b)
shopping_list

for item in shopping_list:
    print(item)


3
gorillas

In [30]:
if "gorillas" in shopping_list:
    print("not cute but dangerous")


not cute but dangerous

In [33]:
foods={}
foods["banana"]="A delicious and tasty treat!"
foods["dirt"]="Not delicious. Not tasty. DO NOT EAT!"
foods


Out[33]:
{'banana': 'A delicious and tasty treat!',
 'dirt': 'Not delicious. Not tasty. DO NOT EAT!'}

In [34]:
%pylab


Using matplotlib backend: Qt4Agg
Populating the interactive namespace from numpy and matplotlib

In [38]:
from scipy import special, optimize

In [41]:
f = lambda x: -special.jv(3, x)
sol = optimize.minimize(f, 1.0)
x = linspace(0, 10, 5000)
plot(x, special.jv(3, x), '-', sol.x, -sol.fun, 'o')


Out[41]:
[<matplotlib.lines.Line2D at 0x7d9e748>,
 <matplotlib.lines.Line2D at 0x7d9e908>]

In [39]:
from __future__ import division
from sympy import *
from IPython.display import display, Math, Latex
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
expr=dsolve(Eq(y(t).diff(t, t) - y(t), exp(t)), y(t))
display(Math(latex(expr)))


$$y{\left (t \right )} = C_{2} e^{- t} + \left(C_{1} + \frac{t}{2}\right) e^{t}$$

In [41]:
a=10

if a==1:
    print(1)
elif a==2:
    print(2)
else:
    print('A lot')


A lot

In [52]:
a=range(10)
for i in a:
    print('Python is counting %s'% str(i))


Python is counting 0
Python is counting 1
Python is counting 2
Python is counting 3
Python is counting 4
Python is counting 5
Python is counting 6
Python is counting 7
Python is counting 8
Python is counting 9

In [ ]: