human
Given a number N in decimal base , find the sum of digits in any base B | Function to compute sum of Digits of Number N in base B.
Initialize sum with 0.
Compute unit digit of the number.
Add unit digit in sum.
Update value of Number.
Driver code"
Solution in Python:
 ... Can you provide a code to given a number N in decimal base , find the sum of digits in any base B and the other steps required?
assistant
#Here is code to given a number N in decimal base , find the sum of digits in any base B and the other steps required.
 def sumOfDigit ( n , b ) :
	unitDigit = 0
	sum = 0
	while ( n > 0 ) :
		unitDigit = n % b
		sum += unitDigit
		n = n // b
	return sum
n = 50
b = 2
print ( sumOfDigit ( n , b ) )