return true if the input integer is even explanation lets take a look at the following decimal to binary conversions 2 10 14 1110 100 1100100 3 11 13 1101 101 1100101 from the above examples we can observe that for all the odd integers there is always 1 set bit at the end also 1 in binary can be represented as 001 00001 or 0000001 so for any odd integer n n1 is always equals 1 else the integer is even iseven1 false iseven4 true iseven9 false iseven15 false iseven40 true iseven100 true iseven101 false return true if the input integer is even explanation lets take a look at the following decimal to binary conversions 2 10 14 1110 100 1100100 3 11 13 1101 101 1100101 from the above examples we can observe that for all the odd integers there is always 1 set bit at the end also 1 in binary can be represented as 001 00001 or 0000001 so for any odd integer n n 1 is always equals 1 else the integer is even is_even 1 false is_even 4 true is_even 9 false is_even 15 false is_even 40 true is_even 100 true is_even 101 false
def is_even(number: int) -> bool:
    
    return number & 1 == 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()