doubleList = [] for i in range(4): doubleList.append(i*2) print doubleList
x = [[4,5,3], [3,6,5], [12,7,16]]
True or False? A byte is 16 bits.
def test(num): if num < 11: print num else: print 11
x = [2,4,5] print x[:-1]
A program can write another program to a file.
def main(): x = 4 print x x = x + 1
z = "two" print len(z)
class Nuance: def __init__(self, x): self.x = x def getX(self): return self.x def main(): mylist = [] for i in range(6): if i % 2 == 0: newObj = Nuance(i) mylist.append(newObj) for i in mylist: print i.getX(),