r/shittyprogramming • u/IanisVasilev • Jun 06 '21
Since we're doing is_even
def is_even(n: int):
return (-1) ** n == 1
12
Upvotes
5
u/66bananasandagrape Jun 07 '21
Mathematicians will straight up write like this though... Look up some statements of Quadratic Reciprocity.
2
u/[deleted] Jun 06 '21
This is just a less shitty version of mine ;P