---
# System prepended metadata

title: Magic

---

# 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
```

