0
How can i write a programme that takes an integer and returns True if its even ,without using multiplication,modulo&disivion .
4 Answers
+ 2
Can you show me what you already tried please? here the community help by guiding you through, but not by doing the task entirely.
(Edit)
And please tag Python as a relevant language, up there â
0
If I understood you can use addition, so I would try for example with one plus one equals two and two is an even number and if it equals searched x return true.
0
You can use '&' operator.
For example if you do-
2 & 1, you can see that it returns 0.
3 & 1, this will return 1.
Hope you got the point.
0
Nums = [1,2,3,4,5]
For x in nums:
If x & 1 == 0:
The & operator works perfectly.
And thank for the feedback peeps.