Odd Numbers in Range
Sometimes you need to quickly count how many numbers with a certain property fall inside a range, without checking each one manually. Given non-negative integers low and high, count the odd numbers from low to high, inclusive. Return that count.
Примеры
Ввод
3, 7Вывод
3Ввод
8, 10Вывод
1Ввод
0, 0Вывод
0Нужно реализовать
def count_odds(low: int, high: int) -> int:
Теги
math
Log in om je inzendingsgeschiedenis te zien
InloggenLog in om de AI-mentor te gebruiken
InloggenVisible tests
1
Input
3, 7Expected
32
Input
8, 10Expected
13
Input
0, 0Expected
04
Input
1, 1Expected
15
Input
2, 9Expected
46
Input
8, 11Expected
2Focus radio
Paused · SomaFM · Fluid