Near and Far

Imagine three points on a number line: one should be close to the main point, while the other should clearly stand apart. Write a function close_far that takes a, b, and c. Return True if one of b or c differs from a by at most 1, and the other differs from both remaining values by 2 or more; otherwise, return False.

Примеры

Ввод
1, 2, 10
Вывод
True
Ввод
1, 2, 3
Вывод
False
Ввод
4, 1, 3
Вывод
True

Нужно реализовать

def close_far(a: int, b: int, c: int) -> bool:

Теги

math
PostgreSQLv16

Tukaj bo rezultat izvajanja kode

Visible tests
1
Input
1, 2, 10
ExpectedTrue
2
Input
1, 2, 3
ExpectedFalse
3
Input
4, 1, 3
ExpectedTrue
4
Input
4, 5, 3
ExpectedFalse
5
Input
5, 4, 9
ExpectedTrue
6
Input
5, 5, 5
ExpectedFalse
Focus radio
Paused · SomaFM · Fluid