Finding different elements #
Write a function that takes two lists as input and returns a new list containing the elements that are present in one list but not the other.
Example #
List 1: [1, 2, 3, 4, 5]
List 2: [4, 5, 6, 7, 8]
Expected Output: [1, 2, 3, 6, 7, 8]
Explanation: Elements 1, 2, 3 are present in List 1 but not in List 2, while the elements 6, 7, 8 are present in List 2 but not in List 1.
Tests #
find_different_elements([1,2,3,4,5], [4,5,6,7,8])should return[1,2,3,6,7,8]find_different_elements(['apple', 'banana', 'grape', 'orange'], ['banana', 'grape', 'kiwi', 'mango'])should return['apple', 'orange', 'kiwi', 'mango']find_different_elements([1,2,3,4,5], [1,2,3,4,5])should return[]find_different_elements([10, 20, 30, 40], [])should return[10, 20, 30, 40]find_different_elements([], ['apple', 'banana', 'cherry'])should return['apple', 'banana', 'cherry']
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules