x =  def find_outlier(integers): count = 0 oddcount = 0 evencount = 0 #loop through length of integers for n in integers: #count should equal length of list by the end, because it goes up for every iteration through integers list count += 1 #below counting number of odd and even integers with oddcount and evencount if n % 2 != 0: oddcount += 1 x = n if n % 2 == 0: eventcount += 1 x = n #loop is over. If count memory is retained from loop, then it should go through the below conditional nest. #Only one conditional should trigger, since the list is meant to contain only 1 even or one odd if len(integers) == count: if oddcount == 1: return x if evencount == 1: return x
The instructions are
You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N.