알고리즘/코드워

[python]Is it even?

(ㅇㅅㅎ) 2020. 3. 30. 19:56
728x90
반응형

https://www.codewars.com/kata/555a67db74814aa4ee0001b5/train/python

 

Codewars: Train your coding skills

Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential.

www.codewars.com

더보기

내 코드

# My Code
def is_even(n):
    return (True if abs(n)%2 == 0 else False)
 
if __name__=='__main__':
    answer = is_even(0)
    print(answer)
    answer = is_even(0.5)
    print(answer)
    answer = is_even(-4)
    print(answer)
    answer = is_even(15)
    print(answer)
반응형