0

How can i write a programme that takes an integer and returns True if its even ,without using multiplication,modulo&disivion .

Python

15th Oct 2020, 7:37 AM
They Call Me Ebbs
They Call Me Ebbs - avatar
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 ☝
15th Oct 2020, 7:42 AM
Ipang
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.
15th Oct 2020, 7:55 AM
JaScript
JaScript - avatar
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.
15th Oct 2020, 9:05 AM
Avinesh
Avinesh - avatar
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.
15th Oct 2020, 11:27 AM
They Call Me Ebbs
They Call Me Ebbs - avatar