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
Consider the formula for the slope between two coordinates
krek1111 [17]

The following equations is equivalent to the slope formula is A) y₂= m(x₂-x₁) + y₁.

<h3>What is slope?</h3>

The angle of inclination of a line with respect to the horizontal is quantified. In analytical geometry, a line, ray, or line segment's slope is the proportion of the vertical to the horizontal distance between any two points ("slope equals rise over run").

<h3>What is equation?</h3>

Two expressions are combined by the equal sign to form a mathematical statement known as an equation. For instance, a formula might be 3x - 5 = 16. We discover that the variable x has a value of 7 after solving this equation.

Given that,

Take a look at the formula below for the slope between two coordinate locations, m.

m = \frac{y_{2}- y_{1} }{x_{2}-x_{1}  }

Here, slope is

m = \frac{y_{2}-y_{1}  }{x_{2}-x_{1}  }

Where m is the slope and y₁ and y₂ and x₁ and x₂ are coordinates of the axis.

The first step is to multiply x₂-x₁ on both sides in order to acquire y₂ on its own.

so you must add y₁ to both sides in order to get y₂ alone.

m(x₂-x₁) +y₁ = y₂.

Therefore, the following equations is equivalent to the slope formula is A) y₂ = m(x₂-x₁) + y₁.

To know more about the slope, visit:

brainly.com/question/16508963

#SPJ9

5 0
1 year ago
(4x + 24)/x
solmaris [256]

Step-by-step explanation:

this is an integer of the interior comes from into juice

7 0
3 years ago
Read 2 more answers
14 &gt; 5(1 - x) + 2 (x +3)
kupik [55]
14  \geq  5(1 - x) + 2 (x +3) \\ \\ 14 \geq 5-5x+2x+6 \\  \\14 \geq 11-3x\\ \\3x \geq 11-14 \\ \\3x \geq -3 \ \ /:3 \\ \\x \geq -1\\ \\x \in
4 0
4 years ago
Read 2 more answers
-3/10 * -5/12how do you solve this ​
Liono4ka [1.6K]
Multiply the numerators and the denominators

15/120 = 3/24 = 1/8
7 0
3 years ago
Evaluate the expression when y = 4. 5 + y + 8
AlexFokin [52]

Answer: 17

Step-by-step explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What constant term should be used to complete the square? x 2 - 5x + _____ = 7
    15·1 answer
  • 50 people are selected randomly from a certain population and it is found that 12 people in the sample are over 6 feet tall. wha
    6·1 answer
  • Quares and Differences of Squares
    13·1 answer
  • Round 35,678 to the nearest thousand
    7·2 answers
  • What is the end behavior of f(x) =log3 (x+7) -1?
    10·1 answer
  • Please help ASAP !!!!!
    14·1 answer
  • Please answer the following question
    6·1 answer
  • Plot −5/4 and it's opposite on the number line.
    6·2 answers
  • Which system of inequalities has no solution ? I’m not sure
    9·1 answer
  • I NEED MENNTAL HAELP
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!