I failed an exam because of one question. The task is:
"Design a program that converts any number from any system to decimal.
We confine to the systems in the range from 2 to 22."
So there I am. I know the binary[2], octal[8], decimal[10] and hexadecimal[16] systems. There's 1 point for each conversion system, so it has to be a converter:
2->10
3->10
...
22->10
I have no idea how is that possible. I asked my professor after the exam how to do it and he said: "Just x to the power of y, multiply, and there it is. There's the same rule for all of them."
I might be mistaken in what he said because I was in the post-exam state of consciousness. Do you guys have any idea how to solve it?
I see that there were a few questions like that on stackoverflow already, but none of them does not solve the problem the way my professor said. Also, we started learning Python ~4 months ago and we haven't learned some of the options implemented in the replies.
"""IN
str/int, any base[2-22]
OUT
decimal int or float"""