Advertisements
Advertisements
प्रश्न
Write a function remove_element() in Python that accepts a list L and a number n. If the number n exists in the list, it should be removed. If it does not exist, print a message saying “Element not found”.
कोड लेखन
Advertisements
उत्तर
def remove_element(L, n):
if n in L:
L.remove(n)
print(L)
else:
print("Element not found")shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
