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
PLEASE HELP WILL MARK BRAINLIEST!!!
vladimir2022 [97]

the coordinates of the vertices after the given transformation are:

  • H' (4, -1)
  • I' (4, 3)
  • G' (1, 0)

<h3>How to get the coordinates of the vertices after the transformation?</h3>

First, we can identify the original vertices, which are:

  • H (4, 1)
  • I (4, -3)
  • G (1, 0)

Now we apply a reflection across the x-axis, it will only change the sign of the y-component of each of the above points, then the coordinates of the vertices after the given transformation are:

  • H' (4, -1)
  • I' (4, 3)
  • G' (1, 0)

If you want to learn more about transformations:

brainly.com/question/4289712

#SPJ1

4 0
1 year ago
Find the 13th term in the following<br> arithmetic sequence :<br> 2, 10, 18, 26, ...
kondor19780726 [428]

Answer:

98

Step-by-step explanation:

This is an arithmetic sequence

The common difference is 10-2 =8

a1 = 2

an = a1+d(n-1)

an = 2+8(n-1)

we want the 13th term

a13 = 2 +8(13-1)

      =2+ 8*12

     = 2+96

     = 98

8 0
4 years ago
Read 2 more answers
Help me YALL!!!!!!!!!
Ivan

Answer:

753.95= 123.95+45w

Step-by-step explanation:

7 0
3 years ago
Read 2 more answers
Solve for x please help
Agata [3.3K]

Step-by-step explanation:

4x + 2 + 3x + 3 = 180 (straight angle)

4x + 3x + 2 + 3 = 180

7x + 5 = 180

7x = 175

x = 25°

6 0
3 years ago
2+4 x 2 = what is the answer
tatyana61 [14]

Answer:

10.

Step-by-step explanation:

You can use PEMDAS to go through the expression: Parentheses, Exponents, Multiplication, Division, Addition, and Subtraction. When there are no parentheses or exponents, you should complete multiplication before addition.

2 + 4 * 2 = 2 + (4 * 2) = 2 + 8 = 10

Hope this helps!

5 0
4 years ago
Other questions:
  • I need help on this Question
    11·1 answer
  • What is the answer<br><br> Find the slope and the y-intercept
    7·1 answer
  • One angle measures 40°.the other two angles have the same measure.What is the measure of each angle?
    12·2 answers
  • Help please!!!!!!!!!!!!!!
    8·1 answer
  • 60% of what number is 180
    10·1 answer
  • Solve the system of linear equations by substitution! SHOW WORK PLEASE
    9·1 answer
  • Help Plis.......................
    6·1 answer
  • on the coordinate grid ,the point (3,3) undergoes a translation 2 over 4 explain what this mean and give the coordinate of it's
    6·1 answer
  • A nut-raisin mix costs $5.26 per pound. Rashid buys 15.5 pounds of the mix for a party. Rashid’s estimated cost of the nut-raisi
    14·2 answers
  • 1. Henri cut a rope into two pieces with lengths having a ratio of 5 to 2. The shorter piece is
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!