# Magic ## mapping to +1,-1,0 ```python= sign = (x > 0) - (x < 0) ``` ## mapping to +1 (x>=0), -1 ```python= sign = [1, -1][x < 0] # a = [1, -1] # flag = x < 0 # a[flag] ``` ## digit reversion ```python= int(str(s)[::-1]) # on the base on ten ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up