Question

Please show how to do the following problems in Python. def removeDups(L1, L2, L3): '''The inputs...

Please show how to do the following problems in Python.

def removeDups(L1, L2, L3):
'''The inputs L1, L2, L3 are lists,
return a list that contains all the items in L1 and L3 but not in L2
'''
#this method requires you to use the remove() function for a list
  

def removeDups2(L1, L2, L3):
'''The inputs L1, L2, L3 are lists,
return a list that contains all the items in L1 and L3 but not in L2
'''
#this method requires you to use the append() function for a list

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def removeDups(L1,L2,L3):
    L=L1+L2+L3
    length=len(L)
    i=0
    while i<length:
        if L[i] in L2:
            L.remove(L[i])
            length=length-1
        else:
            i=i+1
    return L


def removeDups2(L1,L2,L3):
    Lold=L1+L2+L3
    Lnew=[]
    for i in Lold:
        if i not in L2:
            Lnew.append(i)
    return Lnew

Add a comment
Know the answer?
Add Answer to:
Please show how to do the following problems in Python. def removeDups(L1, L2, L3): '''The inputs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT