id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

ferrer@hendrix.edu > logarithm
prev  |  next  |  chance

Write a function to calculate an integer logarithm. Given a value and a base, count the number of times you have to divide the value by the base to get the value down to 1. Return this count.


logarithm(2, 2) → 1
logarithm(1, 2) → 0
logarithm(9, 3) → 2

...Save, Compile, Run (ctrl-enter)

def logarithm(value, base):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Post-solution available

Copyright Nick Parlante 2017 - privacy