God I wish there was an easier way to do thisprogramming.devimage andioop ( @andioop@programming.dev ) Programming Horror@programming.devEnglish • edit-210 months ago message-square27fedilinkarrow-up1115
arrow-up1115imageGod I wish there was an easier way to do thisprogramming.dev andioop ( @andioop@programming.dev ) Programming Horror@programming.devEnglish • edit-210 months ago message-square27fedilink
minus-square SpeakinTelnet ( @SpeakinTelnet@programming.dev ) linkfedilink9•edit-210 months agodef is_even(n): match n: case 1: return False case 0: return True # fix No1 case n < 0: return is_even(-1*n) case _: return is_even(n-2)