In [1]:
print 'Hello World'


Hello World

In [1]:


In [3]:
4 * 4


Out[3]:
16

In [4]:
x = 'infinity'

In [5]:
print x


infinity

In [6]:
x * 3


Out[6]:
'infinityinfinityinfinity'

In [7]:
newlist = []

In [15]:
newlist


Out[15]:
[]

In [16]:
alex = 'elementary'

In [17]:
alex * 4


Out[17]:
'elementaryelementaryelementaryelementary'

In [20]:
newlist.insert


Out[20]:
<function insert>

In [21]:
listclasses=['French', 'Calculus', 'Classics', 'Physics', 'Chemistry']

In [22]:
print listclasses


['French', 'Calculus', 'Classics', 'Physics', 'Chemistry']

In [26]:
listclasses[1]


Out[26]:
'Calculus'

In [27]:
listsongs=['While the world let go', 'Ever enough', 'Forever unstoppable']

In [28]:
listclasses+listsongs


Out[28]:
['French',
 'Calculus',
 'Classics',
 'Physics',
 'Chemistry',
 'While the world let go',
 'Ever enough',
 'Forever unstoppable']

In [32]:
title = 'her highness'

In [33]:
names =['Alex', 'Stephanie', 'Grace']

In [40]:
title + names [1], title+names [0], title+names [2]


Out[40]:
('her highnessStephanie', 'her highnessAlex', 'her highnessGrace')

In [44]:
for i in names:
    print i


Alex
Stephanie
Grace

In [47]:
for f in range(3):
    print f


0
1
2

In [49]:
print 'technology'


technology

In [63]:
x = 'infinity'

In [64]:
for i in range(3):
    print i


0
1
2

In [65]:
x = 'infinity'

In [66]:
print x


infinity

In [69]:
print x+In[33]


infinitynames =['Alex', 'Stephanie', 'Grace']

In [75]:
import random

In [76]:
random.randint(40, 250)


Out[76]:
109

In [77]:
random.randint(12, 45)*4


Out[77]:
160

In [82]:
x = 'do you know what you are doing? '

In [79]:
names=['mum', 'harold', 'chris']

In [80]:
for i in names:
    print i


mum
harold
chris

In [86]:
for i in names:
    print x+i


do you know what you are doing? mum
do you know what you are doing? harold
do you know what you are doing? chris

In [90]:
colour=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']

In [91]:
print colour


['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']

In [94]:
for s in colour:
    print s


red
orange
yellow
green
blue
indigo
violet

In [100]:
x = 'awash in '

In [98]:
for s in colour:
    print s


red
orange
yellow
green
blue
indigo
violet

In [101]:
print x


awash in 

In [102]:
for s in colour:
    print x+s


awash in red
awash in orange
awash in yellow
awash in green
awash in blue
awash in indigo
awash in violet

In [109]:
y = 'but not '

In [110]:
for s in colour:
    print y+x+s


but not awash in red
but not awash in orange
but not awash in yellow
but not awash in green
but not awash in blue
but not awash in indigo
but not awash in violet

In [117]:
for s in colour:
    print y.title()+x+s


But Not awash in red
But Not awash in orange
But Not awash in yellow
But Not awash in green
But Not awash in blue
But Not awash in indigo
But Not awash in violet

In [119]:
for s in colour:
    print y+x+s.upper()


but not awash in RED
but not awash in ORANGE
but not awash in YELLOW
but not awash in GREEN
but not awash in BLUE
but not awash in INDIGO
but not awash in VIOLET

In [127]:


In [122]:


In [ ]: