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
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
12Expected
True2
Input
17Expected
False3
Input
19Expected
True4
Input
20Expected
True5
Input
8Expected
True6
Input
5Expected
FalseFocus radio
Paused · SomaFM · Fluid