@anonymous/

JovialBulkyLacewing

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def r(n,b):
 # `n` is an integer in base 10 and `b` is the base to convert the integer to
 assert b>=2,'Not a valid base! Base must be >=2!'
 count=0;p=[];k=[]
 while 1:
  p.append(b**count)
  count+=1
  if 1<=n/p[-1]<b:
   break
 for i in p[::-1]:
  k.append(str(n//i)if n//i<=9 else chr(55+(n//i))if n//i>9else'0')
  n=n%i
 print(''.join(k))
r(431,20)