In [ ]:
print("asdf asfd")

In [ ]:
"asdf asdf asfd "

In [ ]:
print(2+3)
2+2

In [ ]:
a = 1230

In [ ]:
print(a+1)

In [ ]:
print(a+11)

In [ ]:
a = input()


print(int(a)+1)

2.3.2017


In [1]:
print("xx")


xx

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


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

In [5]:
int('1')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-3c0bffb342e5> in <module>()
----> 1 int('1a')

ValueError: invalid literal for int() with base 10: '1a'

In [3]:
import this


The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

In [5]:
1/2


Out[5]:
0.5

In [6]:
0.1


Out[6]:
0.1

In [7]:
1/10


Out[7]:
0.1

In [12]:
1//2


Out[12]:
0

In [13]:
1%2


Out[13]:
1

In [1]:
1/2


Out[1]:
0

In [2]:
1./2


Out[2]:
0.5

In [1]:
=1

In [2]:



Out[2]:
1

asd as asfd


In [ ]:


In [3]:
# asd asd fasdf
a = 12

In [12]:
if False:
    pass
print("a")
print("b")


a
b

for(int i=1;i<10;i++) { asdf asdf }

In [14]:
for i in range(1,10,1):
    print(i)


1
2
3
4
5
6
7
8
9

In [51]:
l = ['aa', 1 ,2, 2323,'ble']

In [36]:
l[:2:2]


Out[36]:
['aa']

In [ ]:


In [37]:
for i in range(0,len(l),1) :
    print(i,l[i])


0 aa
1 1
2 2
3 2323
4 ble

In [38]:
i = 0
for el in l:
    print(i,el)
    i+=1


0 aa
1 1
2 2
3 2323
4 ble

In [39]:
for i,el in enumerate(l):
    print(i,el)


0 aa
1 1
2 2
3 2323
4 ble

In [41]:
list( enumerate(l) )


Out[41]:
[(0, 'aa'), (1, 1), (2, 2), (3, 2323), (4, 'ble')]

In [59]:
l.append("$Asdfasdf")

In [60]:
l


Out[60]:
['1', '2', '2323', 'Asdfasdf', 'aa', 'ble', '$Asdfasdf']

In [61]:
l.reverse()

In [62]:
l


Out[62]:
['$Asdfasdf', 'ble', 'aa', 'Asdfasdf', '2323', '2', '1']

In [63]:
l.sort()

In [64]:
l = list(map(str,l))
l.sort()

In [65]:
l


Out[65]:
['$Asdfasdf', '1', '2', '2323', 'Asdfasdf', 'aa', 'ble']

In [66]:
l.sort?

In [67]:
l = ['a',1,2]

In [69]:
l.sort(key=lambda x:str(x))

In [70]:
l


Out[70]:
[1, 2, 'a']

In [76]:
import numpy 
import math

In [78]:
sin(1)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-78-93e746b069d9> in <module>()
----> 1 sin(1)

NameError: name 'sin' is not defined

In [74]:
len(dir(numpy))


Out[74]:
600

In [77]:
len(dir(math))


Out[77]:
54

In [79]:
math.sin(1)


Out[79]:
0.8414709848078965

In [80]:
numpy.sin(1)


Out[80]:
0.8414709848078965

In [81]:
numpy.sin?

In [82]:
numpy.sin([1,2,3])


Out[82]:
array([ 0.84147098,  0.90929743,  0.14112001])

In [83]:
math.sin(1)


Out[83]:
0.8414709848078965

In [84]:
math.sin([1,2,3])


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-84-fa0f50f7ee9c> in <module>()
----> 1 math.sin([1,2,3])

TypeError: a float is required

In [96]:
from math import sin,cos

In [95]:
import numpy,math

In [93]:
import numpy as np

In [94]:
np.sin?

In [97]:
from math import *

In [99]:
help(sin)


Help on built-in function sin in module math:

sin(...)
    sin(x)
    
    Return the sine of x (measured in radians).


In [101]:
def mojsin(x):
    """
    To jest mój Narodowy sinus!
    """
    return sin(x)

In [103]:
np.sin?

In [ ]: