tags:

views:

344

answers:

2
 >>> def merge(l1,l2):
        top1=0
        top2=0
        while l1[top1]!=None or l2[top2]!=None:
            if l1[top1]>l2[top2]:
                l.append(11[top1])
                top1=top1+1
                print "added"+l1[top1]
            else:
                l.append(l2[top2])
                top2=top2+1
                print "added"+l2[top2]
        return l

 >>> merge(l1,l2)

Traceback (most recent call last):
  File "<pyshell#58>", line 1, in <module>
    merge(l1,l2)
  File "<pyshell#57>", line 6, in merge
    l.append(11[top1])
TypeError: 'int' object is unsubscriptable
+2  A: 

You have 11 instead of l1.

miles82
+2  A: 

6th line of the code: you have 11 instead of l1.

zoli2k