Find the Odd Parity
In this list, almost all numbers have the same parity: they are either even or odd. Write find_outlier, which finds the only number with the opposite parity and returns it. The list integers always contains at least three numbers, so you can determine which parity is the majority.
Примеры
Ввод
[2, 4, 0, 100, 4, 11, 2602, 36]Вывод
11Ввод
[160, 3, 1719, 19, 11, 13, -21]Вывод
160Ввод
[1, 1, 0, 1, 1]Вывод
0Нужно реализовать
def find_outlier(integers: list[int]) -> int:
Теги
arraymath
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
[2,4,0,100,4,11,2602,36]Expected
112
Input
[160,3,1719,19,11,13,-21]Expected
1603
Input
[1,1,0,1,1]Expected
04
Input
[2,6,8,10,3]Expected
35
Input
[-7,-3,-2,-5]Expected
-26
Input
[2,4,0,100,4,11,2602,36,2]Expected
11Focus radio
Paused · SomaFM · Fluid