Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Conversion of numbers between positional numeral systems. Most common systems are decimal, binary, hexadecimal etc.
0
votes
Balanced Ternary Converter
Python 3, 66
Python 2 answer from xnor, ported to Python 3.
Note that official support for Python 2 ceases on January 1 2020.
n=eval(input())
s=""
while n:s="0+-"[n%3]+s;n=-~n//3
print(s or 0)