0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Codewars 6 kyu Find the odd int

Posted at

Codewars 6 kyu Find the odd int

https://www.codewars.com/kata/54da5a58ea159efa38000836/python
Task
Given an array of integers, find the one that appears an odd number of times.
There will always be only one integer that appears an odd number of times.

Verbalization

Roop integer in seq (use for i in range seat(seq))
Count each integer of seq (use count())
Select integer of occurring odds time (use if count() % 2 == 1 ) and return integer which occurred odds times.

Code

def find_it(seq):
    for i in set(seq):
        if seq.count(i) % 2 == 1:
            return i
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?