7 lines
163 B
Python
7 lines
163 B
Python
def vdc(n, base=2):
|
|
vdc, denom = 0,1
|
|
while n:
|
|
denom *= base
|
|
n, remainder = divmod(n, base)
|
|
vdc += remainder / denom
|
|
return vdc
|