Write a python function to append or extend two lists
Topic: Write a python function to append or extend two lists
Solution
def list_op(l1,l2,op): if(op=='append'): return(l1.append(l2)) else: return(l1.extend(l2)) a = ['Hey', 'you', 'there!'] b = [1,2,3] op='e' list_op(a,b,op) print(a)
List all Python Programs