Find the Nth Even
Even numbers follow a simple pattern: 0, 2, 4, 6, and so on. Write nth_even, which returns the n-th even number using 1-based counting. That means the first even number is 0, the second is 2, and the third is 4.
Примеры
Ввод
1Вывод
0Ввод
3Вывод
4Ввод
100Вывод
198Нужно реализовать
def nth_even(n: int) -> int:
Теги
math
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
1Expected
02
Input
3Expected
43
Input
100Expected
1984
Input
1298734Expected
25974665
Input
2Expected
26
Input
7Expected
12Focus radio
Paused · SomaFM · Fluid