Base change - Position System Base change - Position System
Undefined
English

Positional notation

example

Define a function to convert a number to the base given. For hexadecimal conversion result must show hexadecimal symbols (lowercase or uppercase).

Input: Two arguments. Both are ints.

Output: str.

Example:

tobase(3, 2) == '11'
tobase(5, 7) == '5'

How it’s used: (Used in programming, networking..)

Precondition: 0 ≤ a ≤ 9999999 and 2 ≤ b ≤ 16.