Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
825 B
3
Indexable
        if option==0:
            if len(L)==0:
                L.append(x)
            else:
                L.insert(0,x)
        elif option==1:
            L.append(x)
        elif option==2:
            try:
                pos=L.index(a)
                L.insert(pos+1,x)
            except:
                L.insert(0,x)
        elif option==3:
            try:
                L.remove(x)
            except:
                pass

        elif option==4:
            i=0
            while i < len(L):
               if L[i] == x:
                   L.pop(i)
               else:
                   i += 1
        elif option==5:
            if len(L) > 0:
                L.pop(0)
        elif option==6:
            for ele in L:
                print(ele, end=" ")
            return