Title 1


In [1]:
Title 2


  File "<ipython-input-1-a79fb33050d8>", line 1
    Title 2
          ^
SyntaxError: invalid syntax

In [3]:
Title2


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-6d1a3440ddb5> in <module>()
----> 1 Title2

NameError: name 'Title2' is not defined

In [4]:
print 'hello'


hello

In [5]:
a=1

In [6]:
print a


1

In [7]:
a+2


Out[7]:
3

In [8]:
b=4.34

In [9]:
print b


4.34

In [10]:
print a+b


5.34

In [11]:
c='wow'

In [12]:
print c


wow

In [13]:
a,b,c


Out[13]:
(1, 4.34, 'wow')

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


0
1
2
3
4
5
6
7
8
9

In [15]:
i=0 while i<10:
    #print i


  File "<ipython-input-15-993c5e01812d>", line 1
    i=0 while i<10:
            ^
SyntaxError: invalid syntax

In [16]:
i=0 while i<10:
    print i


  File "<ipython-input-16-555172863b7c>", line 1
    i=0 while i<10:
            ^
SyntaxError: invalid syntax

In [17]:
i=0
while i<10:
    print i
    i=i+1


0
1
2
3
4
5
6
7
8
9

In [20]:
for i in range(0,10,1):
if i==3:
    print 'we have 3'
elif i>3:
    print 'we have many'
else:
    print 'we have few'


  File "<ipython-input-20-13b36d47e836>", line 2
    if i==3:
     ^
IndentationError: expected an indented block

In [22]:
for i in range(0,10,1):
    if i==3:
        print 'we have 3'
    elif i>3:
        print 'we have many'
    else:
        print 'we have few'


we have few
we have few
we have few
we have 3
we have many
we have many
we have many
we have many
we have many
we have many

In [23]:
alist=[1,2,3]

In [24]:
alist[0]


Out[24]:
1

In [25]:
alist[1]


Out[25]:
2

In [26]:
print alist


[1, 2, 3]

In [27]:
dico = {'key1':1, 'key2':3}

In [29]:
dico


Out[29]:
{'key1': 1, 'key2': 3}

In [30]:
dico['key1']


Out[30]:
1

In [31]:
print 'hello' #this is a print


hello

In [ ]: