<prompt> Create an algorithm to find the common elements in two lists.list1 1,2,3,4,5list2 2,4,5,6,7  <response>: Here is a step-by-step algorithm for finding the common elements in two lists:1. Initialize a new list called output to store the common elements.2. Iterate through each element in list1 using a for loop.3. For each element in list1, check if the element is also present in list2 using an if-statement and the in keyword.4. If the element is present in both lists, append it to the output list.5. Once the loop finishes, the output list will contain all the common elements.Here is the Python code that implements this algorithm:list1 1,2,3,4,5list2 2,4,5,6,7output for elem in list1: if elem in list2: output.appendelemprintoutputThis code will output the list 2,4,5, which are the common elements in list1 and list2. 