In [1]:
print("hh")


hh

In [2]:
print("sdfa")


sdfa

In [3]:
range(10)


Out[3]:
range(0, 10)

In [4]:
list(range(10))


Out[4]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In [5]:
list(map(lambda x : x+3 ,(list(range(10)))))


Out[5]:
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

In [6]:
list(map(lambda x: x+3, range(10)))


Out[6]:
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

In [7]:
def add(x):
    return x+3

list(map(add,range(10)))


Out[7]:
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

In [8]:
import numpy as np

In [9]:
a = np.zeros([3,2])
print(a)


[[ 0.  0.]
 [ 0.  0.]
 [ 0.  0.]]

In [10]:
a[1,0] = 2

In [31]:
a


Out[31]:
array([[ 10.,   1.],
       [  2.,   0.],
       [  4.,   8.]])

In [32]:
print(a)


[[ 10.   1.]
 [  2.   0.]
 [  4.   8.]]

In [33]:
import matplotlib.pyplot as pl

In [34]:
print("gg")


gg

In [35]:
print("hh")


hh

In [36]:
%matplotlib inline

In [38]:
pl.imshow(a, interpolation="nearest")


Out[38]:
<matplotlib.image.AxesImage at 0x10d12db00>

In [39]:
print(a)


[[ 10.   1.]
 [  2.   0.]
 [  4.   8.]]

In [40]:
a[0,1] = 1
a[0,0] =10
a[2,0] =4
a[2,1] = 8

In [41]:
print(a)


[[ 10.   1.]
 [  2.   0.]
 [  4.   8.]]

In [42]:
pl.imshow(a, interpolation="nearest")


Out[42]:
<matplotlib.image.AxesImage at 0x10fa5f518>

In [43]:
pl.imshow(a, interpolation="nearest")


Out[43]:
<matplotlib.image.AxesImage at 0x10fc3a358>

In [44]:
pl.imshow(a)


Out[44]:
<matplotlib.image.AxesImage at 0x10fccc048>

In [45]:
pl.imshow(a, interpolation="nearest")


Out[45]:
<matplotlib.image.AxesImage at 0x10fdb6358>

In [46]:
import random as rand

In [47]:
arr = list(range(1,10))
arr = rand.shuffle(arr)

In [48]:
print(arr)


[1, 2, 3, 4, 5, 6, 7, 8, 9]

In [49]:
print(rand.randrange(1,10))


4

In [50]:
for i in range(1,10):
    print(rand.randrange(1,10))


7
1
2
7
2
3
9
6
7

In [51]:
rand.sample(range(1,10),2)


Out[51]:
[1, 2]

In [52]:
k = rand.sample(range(100),10)

In [53]:
print(k)


[68, 6, 28, 40, 62, 71, 98, 58, 32, 9]

In [ ]:


In [54]:
[k]


Out[54]:
[[68, 6, 28, 40, 62, 71, 98, 58, 32, 9]]

In [55]:
pl.imshow([k])


Out[55]:
<matplotlib.image.AxesImage at 0x110004f60>

In [56]:
pl.imshow([k],interpolation="nearest")


Out[56]:
<matplotlib.image.AxesImage at 0x11009a358>

In [57]:
tmp = []
for i in range(1000):
    tmp.append(rand.sample(range(1000),1000))


pl.imshow(tmp, interpolation="nearest")


Out[57]:
<matplotlib.image.AxesImage at 0x112098ac8>

In [58]:
pl.imshow(tmp)


Out[58]:
<matplotlib.image.AxesImage at 0x118759cc0>

In [73]:
tmp = []
for i in range(50):
    tmp.append(rand.sample(range(100),50))


pl.imshow(tmp, interpolation="nearest")


Out[73]:
<matplotlib.image.AxesImage at 0x111d9c0f0>

In [74]:
pl.imshow(tmp)


Out[74]:
<matplotlib.image.AxesImage at 0x11300a7b8>

In [75]:
array = rand.sample(range(10),10)

In [76]:
print(array)


[2, 1, 6, 8, 5, 0, 9, 3, 7, 4]

In [80]:
class Foo:
    def func():
        print("A")
    
    def func2(self):
        print(id(self))
        print("B")

In [81]:
f = Foo()
f.func2()


4566053944
B

In [82]:
print(id(f))


4566053944

In [ ]: