In [1]:
print "hello!"


hello!

In [5]:
x=7

In [6]:
x.bit_length()


Out[6]:
3

In [7]:
type(x)


Out[7]:
int

In [8]:
x=0.25

In [9]:
type(x)


Out[9]:
float

In [10]:
x.as_integer_ratio()


Out[10]:
(3537115888337719L, 1125899906842624L)

In [11]:
x="Hello world"

In [12]:
type(x)


Out[12]:
str

In [14]:
x.split()


Out[14]:
['text']

In [15]:
x= (1,2,3,"text")

In [16]:
x[3]


Out[16]:
'text'

In [18]:
x = [3,4,5]
print(x)


[3, 4, 5]

In [20]:
x.append(23)

In [21]:
x.pop()


Out[21]:
23

In [22]:
print x


[3, 4, 5]

In [23]:
x = {"key":"value",5:"tree"}

In [24]:
print x


{5: 'tree', 'key': 'value'}

In [25]:
x[5]


Out[25]:
'tree'

In [27]:
x["key"]


Out[27]:
'value'

In [28]:
x["cat"] = "a small animal"

In [29]:
print x


{5: 'tree', 'key': 'value', 'cat': 'a small animal'}

In [30]:
for i in [3,5,2,57,8,3,2,5]:
    print i


3
5
2
57
8
3
2
5

In [33]:
i=0
while(i <5):
    print i
    i+=1


0
1
2
3
4

In [36]:
def f(x):
    y = x*x
    return y

In [37]:
f(4)


Out[37]:
16

In [6]:
%%timeit -n1
with open("fibo_input.txt","r") as f:
    x=f.read()


2
3
10
27
48
56
75
89
92
2
3
10
27
48
56
75
89
92
2
3
10
27
48
56
75
89
92
1 loop, best of 3: 437 µs per loop

In [4]:



---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-67b59bf82149> in <module>()
----> 1 for i in x:
      2     print x

NameError: name 'x' is not defined

In [ ]:


In [ ]: