defhalving_sum(n):# your code here
exp=0currentNumber=0answer=0whilen>=int(pow(2,exp)):currentNumber=int(n/pow(2,exp))answer+=currentNumberexp+=1returnanswer
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is the simple solution with Python: