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

 

konstans@stuy.edu all > countDigits
prev  |  next  |  chance

Calculate the number of digits in an integer. When the number is negative, ignore the negative sign, and just look at the numbers.


countDigits(0) → 1
countDigits(4) → 1
countDigits(12) → 2

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

def countDigits(n):

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

Copyright Nick Parlante 2017 - privacy