Created
November 21, 2023 01:39
-
-
Save limpido/06e04d673b2c1f158c90152e3cbd87ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
f(1) = -1 | |
f(-1) = 1 | |
""" | |
def f1(x): | |
return -x | |
def f2(x): | |
return 1 if len(str(x)) > 1 else -1 | |
def f3(x): | |
arr = [None, -1, 1] | |
return arr[x] | |
def f4(x): | |
s = set([1, -1]) | |
s.remove(x) | |
return list(s)[0] | |
def f5(x): | |
return (x ^ -1) + 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment