0 out of 464 challenges solved
Write a Python function `list_difference(list1, list2)` that takes two lists as input and returns a list containing the symmetric difference of the two lists. The symmetric difference includes all elements that are in either of the lists but not in both. #### Example Usage ```python [main.nopy] list1 = [10, 15, 20, 25, 30, 35, 40] list2 = [25, 40, 35] print(list_difference(list1, list2)) # Output: [10, 15, 20, 30] list1 = [1, 2, 3, 4, 5] list2 = [6, 7, 1] print(list_difference(list1, list2)) # Output: [2, 3, 4, 5, 6, 7] list1 = [1, 2, 3] list2 = [6, 7, 1] print(list_difference(list1, list2)) # Output: [2, 3, 6, 7] ```
def list_difference(list1, list2): """ Returns the symmetric difference of two lists. Args: list1 (list): The first list. list2 (list): The second list. Returns: list: A list containing elements that are in either of the lists but not in both. """ # Implement the function logic here pass