0

I'm trying to convert a number to base 11 in python. But it is giving me the wrong output or may be the syntax I'm using is incorrect.

print(int('120',11))

In http://extraconversion.com, it is saying that base 10 to base 11 conversion of number 120 is AA. But the above python statement is giving me output 143. Where am I doing it wrong?

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Sukumar
  • 171
  • 10
  • 3
    You're going the opposite direction. `120` in base 11 is `143` in base 10, which is what your code is doing. This behavior is [clearly documented](https://docs.python.org/3/library/functions.html#int) – user3483203 Aug 20 '18 at 19:37
  • How do I do the conversion then? – Sukumar Aug 20 '18 at 20:05

0 Answers0