Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.2 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6939b873185d8e00d453563b Challenge 156: Odd or Even? 29 challenge-156

--description--

Given a positive integer, return "Odd" if it's an odd number, and "Even" if it's even.

--hints--

odd_or_even(1) should return "Odd".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even(1), "Odd")`)
}})

odd_or_even(2) should return "Even".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even(2), "Even")`)
}})

odd_or_even(13) should return "Odd".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even(13), "Odd")`)
}})

odd_or_even(196) should return "Even".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even(196), "Even")`)
}})

odd_or_even(123456789) should return "Odd".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even(123456789), "Odd")`)
}})

--seed--

--seed-contents--

def odd_or_even(n):

    return n

--solutions--

def odd_or_even(n):
    return "Even" if n % 2 == 0 else "Odd"