0
how to determine base key?
in this case i want to find even number when user put a negative input as number now how can find this is a even or odd when base key is x == 0
1 Resposta
0
I am not sure I got your question right, but the easiest way to check if an integer is even or not is to bitwise AND it with 1 (var&1), like this:
a=1
print("the number is "+"not "*(a&1)+"even")