In [1]:
lists = [ [1,2,3], [4,5,6], [7,8,9] ]
print lists[0]
print lists[0][0]
In [2]:
#same as
print "WorDs thAT aRE nOt CapitALiZed CorRectlY".lower().title()
In [4]:
word_lists = [ ["cat","dog","fish"], ["red","blue","green"] ]
print word_lists[1][2].title()
is keyword
In [6]:
a = 7
b = 7
print a == b
print a is b
In [8]:
a = 'dog'
b = 'dog'
print a == b
print a is b
In [10]:
a = [ 1,2 ]
b = [ 1,2 ]
print a == b
print a is b
a.append(5)
b.append(3)
print a
print b
del a
del b
In [11]:
a = [ 1, 2]
b = a
print a == b
print a is b
In [12]:
a.append(3)
print b
In [13]:
x = False
print x is False
In [15]:
a = [1,2]
b = a + [3]
print a
print b
In [16]:
a = [1 , 2]
b = a
b = a + [3]
a = a + [3]
print a == b
print a is b
In [17]:
def del_head(t):
del t[0]
def tail(t):
return t[1:]
a = [1,2,3]
b = [1,2,3]
print a
del_head(a)
print a
print b
print tail(b)
print b
In [22]:
a = [1,2,3]
b = a[:]
c = list(a)
d = a + []
print a
print b
print c
print d
print a is c
del a[0]
print d
In [ ]: