In [10]:
def my_func(name):
print("hello "+ name )
my_func("gediz")
In [8]:
4+5
Out[8]:
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)
In [30]:
if "gorillas" in shopping_list:
print("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]:
In [34]:
%pylab
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]:
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)))
In [41]:
a=10
if a==1:
print(1)
elif a==2:
print(2)
else:
print('A lot')
In [52]:
a=range(10)
for i in a:
print('Python is counting %s'% str(i))
In [ ]: