Files
freeCodeCamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/6939b873185d8e00d453563b.md

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" is 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"