You must log in or register to comment.
return true
is correct around half of the time
import re def is_even(i: int) -> bool: return re.match(r"-?\d*[02468]$", str(i)) is not None
i was gonna suggest the classic
re.match(r"^(..)\1*$", "0" * abs(i)) is not None
If number%2 == 0: return("Even") Else: return("odd")
Not all ARM CPUs support mod operations. It’s better to use bit operations. Check if the last bit is set. If set it’s odd else it’s even.