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
Which equation a line that goes through the points (1, 5) and (-2,2)
Korolek [52]

Answer:

y= x+ 4

is the answer

<h2>hope it helped </h2>
6 0
3 years ago
If John has 4 apples and Kamira has 3, then Mahiya gives Kamira 6 more apples and Jayla gives John 10 more apples, how many do t
Vaselesa [24]

Answer:

Kamira has 9 apples and John has 14 apples

Step-by-step explanation:

first you add 6+4 to get 10

then add 4+10 to get 14

8 0
3 years ago
Circle P has a circumference of approximately 75 inches.
photoshop1234 [79]

Answer:

12in is you answer

Step-by-step explanation:

The formula to find circumference is C=2\pi r

so to rearrange to solve for radius that will be r=\frac{C}{2\pi }

=\frac{75}{2\pi }

=11.94in

5 0
3 years ago
Susan Johnson earns a yearly salary of $83,280. a. How much would Susan be paid if she were
Umnica [9.8K]
Just divide the 83,280 by 12, when you do that you get 6940. So 6940 is how much she makes per month then you take that 6940 and divide it by 4 to get what she makes per week, when you do that you get 1735.

So, Susan Johnson would earn 6940$ per month if she would be paid per month and if she was paid per week she would earn 1735$ per week.
5 0
3 years ago
george completed 3/5th of work in 9 days with the help of paul he completes remaining work in 4 days.In how many days paul alone
IRINA_888 [86]
If George completed 3/5 of work in 9 days, it means that he needs 3 days to finish 1/5th of the work.

The remaining part is 2/5 because 1-3/5=2/5. 2/5 is also 6/15

From this, how much did George do? in the first 3 days he did 1/5th and then one more day was left, during which he did 1/5/3=1/15th.

So he did in total 1/15+1/5=1/15+3/15=4/15.
this means that Paul did the rest of 6/15, so Paul did 6/15-4/15=2/15.

So we know that he does 2/15 in 4 days, which means that every two days he can do 1/15 of the work

so he would need 15 times 2 days to finish the work - 30 days!
6 0
3 years ago
Other questions:
  • Rico bought a Video game usually cost $40, but was on sale for 25% off. How much did Rico hey for the video game
    13·2 answers
  • What is the relationship between turning points of a graph and its derivative function​
    15·1 answer
  • Someone please help me with this!!!
    14·1 answer
  • Find the coordinates of Rif M(-4, 5) is the midpoint<br> of RS and S has coordinates (0, -10).
    10·1 answer
  • What’s the perimeter?
    6·1 answer
  • Let the random variable X be the number of rooms in a randomly chosen owner-occupied housing unit in a certain city. Here are th
    14·1 answer
  • Point D is located at (-4,4), Point E is located at (4,4), Point F is located at (4,2) and Point G is located at (-4,2). What is
    7·1 answer
  • Oo what is 32 x 23 / 21
    6·2 answers
  • There is a elephant shaped weather vane at the top of a corn dryer tower that is 45 m high. If the weather vane weighs 190 N, wh
    13·1 answer
  • Can someone pls help me/?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!