Even or Odd
Checking parity is one of the most common small checks in programming, from filtering lists to simple game rules. Write even_or_odd, which takes an integer n. If the number is even, return the string even; if it is odd, return odd.
Примеры
Ввод
0Вывод
"even"Ввод
1Вывод
"odd"Ввод
2Вывод
"even"Нужно реализовать
def even_or_odd(n: int) -> str:
Теги
math
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible tests
1
Input
0Expected
"even"2
Input
1Expected
"odd"3
Input
2Expected
"even"4
Input
-3Expected
"odd"5
Input
100Expected
"even"6
Input
7Expected
"odd"Focus radio
Paused · SomaFM · Fluid