Close to Ten
This kind of logic is useful when you need to know whether a number is close to a clean round marker. Write a function near_ten that takes a non-negative number num. Return True if the number is no more than 2 away from the nearest multiple of 10. Otherwise, return False.
Примеры
Ввод
12Вывод
TrueВвод
17Вывод
FalseВвод
19Вывод
TrueНужно реализовать
def near_ten(num: int) -> bool:
Теги
math
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolTests12
Visible tests
Test moħbi 7
Test moħbi 8
Test moħbi 9
Test moħbi 10
Test moħbi 11
Test moħbi 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid