def dec_to_bin(n): ans = 0 f = 0 n = int(n) while (n != 0): ans += ((10 ** f) * (n % 2)) n = n // 2 f += 1 return ans def bin_to_dec(n): ans = 0 f = 0 n = int(n) while (n != 0): ans += ((2 ** f) * (n % 10)) n = n // 10 f += 1 return ans def oct_to_dec(n): ans = 0 f = 0 n = int(n) while (n != 0): ans += ((8 ** f) * (n % 10)) n = n // 10 f += 1 return ans def hex_to_dec(n): ans = 0 return 0