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
Logi sisse, et näha esituste ajalugu
Logi sisseLogi sisse, et kasutada AI mentorit
Logi sisseVisible tests
1
Input
1, 2, 10Expected
True2
Input
1, 2, 3Expected
False3
Input
4, 1, 3Expected
True4
Input
4, 5, 3Expected
False5
Input
5, 4, 9Expected
True6
Input
5, 5, 5Expected
FalseFocus radio
Paused · SomaFM · Fluid