I've tried to make a ternary calculator on Python, with some other functions like hex, bin, and oct with the built-in functions. There isn't one for ternary so I built one.
def ternary(n):
e = n/3
q = n%3
e = n/3
q = e%3
return q
i = int(input("May you please give me a number: "))
print("Binary "+bin(i))
print("Octal "+oct(i))
print("Hexadecimal "+hex(i))
print("Ternary "+ternary(i))
enter code here
But it doesn't work. Why? Where is the problem?