Destide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 2 months agoInfallible Codelemmy.mlimagemessage-square165linkfedilinkarrow-up1487arrow-down127
arrow-up1460arrow-down1imageInfallible Codelemmy.mlDestide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 2 months agomessage-square165linkfedilink
minus-squareolenko@feddit.nllinkfedilinkarrow-up6·edit-22 months agodef is_even(num): num = num & 1 if num == 0: return False if num == 1: return True raise ValueError(f'what the fuck') EDIT: forgor to edit the numbers
minus-squarekryptonianCodeMonkey@lemmy.worldlinkfedilinkarrow-up10·2 months agoIf you’re waiting for “num & 1 == 2”, you’re going to be very disappointed
def is_even(num): num = num & 1 if num == 0: return False if num == 1: return True raise ValueError(f'what the fuck')
EDIT: forgor to edit the numbers
If you’re waiting for “num & 1 == 2”, you’re going to be very disappointed