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
Need help with all three
Pachacha [2.7K]

Answer:

i can only do 2 and 3 sorry

2. a

3.d

Step-by-step explanation:

7 0
3 years ago
Find the area D (1,3) F (-4,-3) E (4, -3)​
tresset_1 [31]

Answer:

Step-by-step explanation:

FE=4+4=8

Altitude=3+3=6

area=1/2×FE×6=1/2×8×6=24 sq. units.

or

area=1/2×

I 1   3|

|-4 -3|

| 4 -3|

|  1  3|

=1/2[(-3+12)+(12+12)+(12+3)]

=1/2[9+24+15]

=1/2[48]

=24 sq. units

7 0
3 years ago
Which properties of logarithms help you simplify log 200 + log 5 - log 100? (Select all that apply.)
bearhunter [10]

Answer:quotient property

Product property

Step-by-step explanation:

Just took the test

5 0
3 years ago
Which linear function represents the table
ioda

Answer:

C) 6x+2

Step-by-step explanation:

if you multiply 6 by all the x factors and add 2 you get the y factors

8 0
3 years ago
Which statement is correct about y = cos^–1 x?
Maurinko [17]

Answer:

A) If the domain of y=cos(x) is restricted to [0, π], y=cos^-1(x) is a function.

Step-by-step explanation:

In order for the inverse function to be a function, the original must pass the horizontal line test: a horizontal line must intersect the function in only one place.

As you can see from the attached graph, restricting the cosine function to the domain [0, π] allows it to pass the horizontal line test, so its inverse will be a function.

__

Restricting the domain to [-π/2, π/2] does not limit cos(x) to something that will pass the horizontal line test.

5 0
3 years ago
Other questions:
  • How to estimate 19 divided 1425
    9·1 answer
  • A retirement community has a sign at its main entrance that says "Residents over the age of 55 welcome." Which of the following
    5·2 answers
  • A coin which is tossed straight up into the air. After it is released it moves upward, reaches its highest point and falls back
    15·1 answer
  • Simplest form -4j-1-4j+6
    14·1 answer
  • Identify the property’s that justifies the statement: If 4x-3=7, then 4x=10
    8·1 answer
  • Factorise:2x^4+x^3-14x^2-19x-6
    15·1 answer
  • Please help i will give brainliest and thanks !!!!
    6·1 answer
  • 2^m ÷ 2^ -4 = 4^5 pls help
    15·1 answer
  • Which ordered pair could be removed from the graph to create a set of ordered pairs that represents a function?
    15·1 answer
  • Using measures of center and variability to compare data- quiz answers?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!