Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function called find_dups that takes a list of integers as its input arg

ID: 3633565 • Letter: W

Question

Write a function called find_dups that takes a list of integers as its input
argument and returns a list of those integers that occur two or more times in
the list.

Explanation / Answer

def find_dups(inlist): ....local_dict = dict() ....return_set = set() ....# While loop populates dictionary ....while len(inlist) > 0: # Will terminate because of the pop ........current_element = inlist.pop() ........if current_element in local_dict: ............local_dict[current_element… += 1 ........else: ............local_dict[current_element… = 1 ....# For each element in the dict whose value is greater than 1, add to return_set ....for each in local_dict: ........if local_dict[each] > 1: ............return_set.add(each) ....return return_set

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote