Destide to Programmer Humor@lemmy.mlEnglish • 1 month agoInfallible Codelemmy.mlimagemessage-square162fedilinkarrow-up1491arrow-down124
arrow-up1467arrow-down1imageInfallible Codelemmy.mlDestide to Programmer Humor@lemmy.mlEnglish • 1 month agomessage-square162fedilink
minus-squareolenkolinkfedilink6•edit-21 month 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-square@kryptonianCodeMonkey@lemmy.worldlinkfedilink10•1 month 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