Skip to content

Latest commit

 

History

History
46 lines (25 loc) · 576 Bytes

Find_the_odd_int.md

File metadata and controls

46 lines (25 loc) · 576 Bytes

CodeWars Python Solutions


Find the odd int

Given an array, find the integer that appears an odd number of times.

There will always be only one integer that appears an odd number of times.


Given Code

def find_it(seq):
    pass

Solution 1

def find_it(seq):
    return min([n for n in seq if seq.count(n) % 2 != 0])

Solution 2

def find_it(seq):
    return [i for i in seq if seq.count(i) % 2 != 0][0]

See on CodeWars.com