1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aliya0001 [1]
3 years ago
13

Complete the function digits(n) that returns how many digits the number has. For example: 25 has 2 digits and 144 has 3 digits

Mathematics
1 answer:
ss7ja [257]3 years ago
3 0

Answer:

Step-by-step explanation:

We can get this done by using the code

def digits(n):

count = 0

if n == 0:

return 1

while (n > 0):

count += 1

n= n//10

return count

Also, another way of putting it is by saying

def digits(n):

return len(str(n))

------------------------------------------

print(digits(25)) # Should print 2

print(digits(144)) # Should print 3

print(digits(1000)) # Should print 4

print(digits(0)) # Should print 1

Doing this way, we've told the system to count the number of figures that exist in the number. If it's 1000 to 9999, then it records it as 4 digits. If it's 100 - 999, then it records it as 3 digits. If it's 10 - 99, it records as 2 digits. If it's 0 - 9, then it has to record it as a single digit.

Thanks

You might be interested in
Whats half of 70.00 dollars
Liono4ka [1.6K]


Half of 70.00 dollars

To Find the HALF of something, Divide the number by 2

So 70.00 Dollars/ 2 Dollars

Answer is: 35 Dollars

To Check Answer Multiply the answer by 2

35 Dollars* 2= 70.00 Dollars.

6 0
3 years ago
Read 2 more answers
PLEASE HELP I NEED TO FINISH THIS
Akimi4 [234]

Answer:

hhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiii

Step-by-step explanation:ujjj

6 0
4 years ago
A rectangle's length is three times its width. Let w denote the rectangle's width. What polynomial represents the rectangle's ar
Nataliya [291]
Width = W
Length = 3 times w = 3W

Area = length x width = 3W * W = 3W^2
8 0
3 years ago
Is this true or false need answer asap
VLD [36.1K]
Answer: True

Step-by-Step Explanation:

=> 2x + 3y = -7 (Eq. 1)
=> -x = 2y (Eq. 2)
=> x = 1, y = -3

Substitute values of ‘x’ and ‘y’ in Eq. 1 :-

=> 2x + 3y = -7
= 2(1) + 3(-3) = -7
= 2 + -9 = -7
=> -7 = -7
=> LHS = RHS

Therefore, it is a Solution.
3 0
2 years ago
Answerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr pls
Gelneren [198K]

Answer:

the answer is b.11

Step-by-step explanation:

4 0
3 years ago
Other questions:
  • I need the answer ASAP with give Brainlyest
    15·1 answer
  • Fifteen is greater than 3
    7·2 answers
  • How can you determine if two triangles are congruent when you are given the coordinates of the vertices ?
    15·2 answers
  • The flow of water from a faucet can fill a 5 -gallon container in 20 seconds. Give the ratio of gallons to seconds as a rate in
    11·1 answer
  • When a ferry boat is on open water, it travels at a constant speed. A ferry boat traveled 4 miles in 10 minutes. Complete the eq
    7·2 answers
  • What is (fog)(x)?<br> f(x) = x?<br> g(x) = 3x + 3
    8·2 answers
  • Rafael spins the pointers of the two spinners shown at the right. Find the probability of each possible sum.
    10·1 answer
  • What is the volume of the right prism?
    11·1 answer
  • Austin is comparing the prices of two truck rental companies. Company A charges $4 per hour and an additional $70 as service cha
    6·1 answer
  • PLEASE HELP OMG PLEASE!!!!!!!!!!!! A football player weighed 170 pounds in May. During the summer, he gained 25 pounds. During t
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!