Comment on I wish
Enkers@sh.itjust.works 8 months ago
def is_even (num): return num in [x*2 for x in range(sys.maxsize << 1)]
Comment on I wish
Enkers@sh.itjust.works 8 months ago
def is_even (num): return num in [x*2 for x in range(sys.maxsize << 1)]
goddard_guryon@sopuli.xyz 8 months ago
That won’t work tho, you need to make it sys.maxsize//2 to coerce the output into int form
robotica@lemmy.world 7 months ago
range()
accepts floats, does it not?goddard_guryon@sopuli.xyz 7 months ago
IIRC it doesn’t; that has caused me pain so many times when trying to generate fractional range