In [1]:
x=True

In [2]:
y=100<10

In [3]:
y


Out[3]:
False

In [4]:
x+y


Out[4]:
1

In [5]:
type(y)


Out[5]:
bool

In [6]:
a,b=1,2

In [8]:
c,d=2.5,10.0

In [9]:
type(a)


Out[9]:
int

In [10]:
type(c)


Out[10]:
float

In [11]:
x=complex(1,2)
y=complex(2,1)

In [12]:
x*y


Out[12]:
5j

In [13]:
type(x)


Out[13]:
complex

In [14]:
x=('a','b')

In [18]:
x += ('c',)
print(x)


('a', 'b', 'c')

In [19]:
x=[1,2]

In [20]:
x[0]=10

In [21]:
print(x)


[10, 2]

In [22]:
x=(1,2)

In [23]:
x[0]=10


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-6cb4d74ca096> in <module>()
----> 1 x[0]=10

TypeError: 'tuple' object does not support item assignment

In [24]:
print(x[0])


1

In [26]:
integers = (10, 20, 30)
(x,y,z)=integers
print(x,y,z)


10 20 30

In [27]:
a=[2,4,6,8]

In [28]:
a[1:]


Out[28]:
[4, 6, 8]

In [32]:
a[1:2]


Out[32]:
[4]

In [34]:
a[:1]


Out[34]:
[2]

In [35]:
a[-2:]


Out[35]:
[6, 8]

In [38]:
s='おはよう'

In [39]:
s[-3:]


Out[39]:
'はよう'

In [57]:
d={'name':'Frado', 'age':33, 'age':[3,8]}
print(d)


{'name': 'Frado', 'age': [3, 8]}

In [41]:
type(d)


Out[41]:
dict

In [43]:
d['age']


Out[43]:
'33'

In [47]:
s1={'a', 'b'}

In [48]:
type(s1)


Out[48]:
set

In [50]:
s2=set(('b','c'))

In [51]:
type(s2)


Out[51]:
set

In [52]:
s1.issubset(s2)


Out[52]:
False

In [53]:
s1.intersection(s2)


Out[53]:
{'b'}

In [54]:
s3=set(('foo','bar','foo'))

In [55]:
s3


Out[55]:
{'bar', 'foo'}

In [58]:
from math import *

In [59]:
sqrt(4)


Out[59]:
2.0

In [ ]: