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]
2 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]2 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
What is the solution to the inequality 7<=-3x-4
kipiarov [429]

Answer:

The nearest option is -3 (negative 3)

So, Option B is correct.

Step-by-step explanation:

We need to solve the inequality 7 \leq  -3x-4

Solving:

Step 1: Switching sides of inequality and reversing the inequality

-3x-4\geq 7

Step 2: Adding 4 on both sides

-3x-4+4\geq 7+4\\-3x\geq 11

Step 3: Dividing both sides by -3 and reversing the inequality

\frac{-3x}{-3}\leq \frac{11}{-3}  \\x\leq -3.6\\

The nearest option is -3 (negative 3)

So, Option B is correct.

4 0
3 years ago
What is angle A equal? <br><br> Thanks :)
Alex Ar [27]
Angle A and angle B sums up to 180 (interior angles)

6x - 35 + 3x + 53 = 180
9x + 18 = 180
9x = 162
x = 18

angle A = 6(18)-35 = 73 degrees
7 0
2 years ago
Read 2 more answers
The veloctiy of sound in air is given by the equation v=20 times the square root of 273+t where v is the velocity in meters per
Nikitich [7]
So we just need to plug in our values and solve
v = 20 \sqrt{273 + t}
we are given v is 369 so we have
369 = 20 \sqrt{273 + x}
now we solve for x.
divide both sides by 20
square both sides
subtract 273 from both sides
369 = 20 \sqrt{273 + x}  \\ 18.45 =  \sqrt{273 + x}  \\ 340.40 = 273 + x \\ x = 67.4
so a temp of about 67 degrees C
5 0
3 years ago
Read 2 more answers
12.2 ounces of chocolate O”s for $2.42
Pie

Answer:

If the person bout one box of chocolate O's than they paid $2.2 for 12 ounces

3 0
3 years ago
How would the number 6,870,000,000,000,000 appear in scientific notation on a calculator screen
kvv77 [185]
687 to the 15 power I believe
5 0
3 years ago
Other questions:
  • Use greatest common factor and the distributive property to write equivalent expressions in factored form. 2 +8
    8·1 answer
  • Help please I don't understand:(
    6·1 answer
  • Sides of a triangle are in the ratio of 12:17:25 and A perimeter of 540 cm. Find its area
    7·1 answer
  • Which equation can be used to find the volume of this solid?<br>​
    6·2 answers
  • Find the surface area of the pyramid. Thanks you.
    6·1 answer
  • the 2nd term in a geometric sequence is 20 the 4th term in the same sequence is 45/4 or 11.25 what is the common ratio?
    10·2 answers
  • If you previously completed the Plan a Food Budget lesson or the Salary-Based budget, how does the cost of this one meal compare
    5·1 answer
  • chris worked 3 1/2 hours at his uncles farm. He was paid 8$ for every 1/4 hour he worked. How much money did chris make
    11·1 answer
  • Question below in photo!! Please answer! Will mark BRAINLIEST! ⬇⬇⬇⬇⬇⬇⬇
    5·1 answer
  • Given: 2x + b &gt; -3. Find the value of b so that x &gt; 3<br>Help a s a p please
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!