# Interview question: Find the second largest element of an array in Python

If one wants to become a Python developer, he needs to become familiar with the many algorithms in circulation because he may very well be asked to prove his knowledge of the subject at an interview.

One coding question that could very well come up is how to find the second largest element in a list. The simple way to solve this problem is to sort the list and take the second to last element from that list.

The psuedocode to find the second largest element of a list is:-

- Define an unsorted list, lst_1.
- Define a function, find_sec_largest, which will accept the unsorted list as its input.
- Within the function, define the variable, len_lst, which is the length of the unsorted list.
- Within the function, use the sorted inbuilt function to sort the list, calling it sorted_lst.
- Within the function, define the variable, seeond_largest, which is the penultimate element of the sorted list.
- The function will return the variable, second_largest.

Of course there are a number of ways that the list can be sorted, and I have demonstrated a few of those ways in the blog, such as the bubble sort method and the insertion sort method. For brevity, however, I decided to use Python’s inbuilt sort function, which completes the job without all of the fuss.