repl.it
@tsimpson1379/

Base10-base17

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from math import log
e = '23102384890'

 
# Converts integers from any base to any other base

d='0123456789ABCDEFG'

e=int(e)
col = log(e,17)
  
numOut = ''
remaining = e

while remaining > 0 and col >= 1:
  val = 0
  while remaining > val*col:
    val += 1
  val -= 1
  if col == 1:
    numOut += d[val+1]
  else:
    numOut += d[val]
  remaining -= val*col
  col /= 17

print('Result: '+numOut)
?