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
PostgreSQLv16

Šeit parādīsies koda izpildes rezultāts

Visible tests
1
Input
1
Expected0
2
Input
3
Expected4
3
Input
100
Expected198
4
Input
1298734
Expected2597466
5
Input
2
Expected2
6
Input
7
Expected12
Focus radio
Paused · SomaFM · Fluid