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
Romashka [77]
2 years ago
15

Write a recursive function called digit_count() that takes a positive integer as a parameter and returns the number of digits in

the integer. Hint: The number of digits increases by 1 whenever the input number is divided by 10.
Ex: If the input is:

345
the function digit_count() returns and the program outputs:

3
Computers and Technology
1 answer:
Gelneren [198K]2 years ago
8 0

Using the computational knowledge in python it is possible to write a code that Write a recursive function called digit_count()

<h3>What is a function in Python?</h3>

In Python, a function is a sequence of commands that performs some task and that has a name. Its main purpose is to help us organize programs into chunks that correspond to how we envision a solution to the problem.

<h3>Writting the code in python:</h3>

<em>def countDigits(n):</em>

<em>   if n< 10:</em>

<em>      return 1</em>

<em>   else:</em>

<em>       return 1 + countDigits(n / 10)</em>

See more about python at brainly.com/question/13437928

#SPJ1

You might be interested in
What are the nuclear codes?
inn [45]

Answer:

Nuclear codes allow the president to prove the individual is authorized to order the launch.

Explanation:

Hope this helps!

If not, I am sorry.

3 0
1 year ago
A business letter should always include the address of the sender.<br> True<br> False
8090 [49]

Answer:

true

Explanation:it is true because like that they could send that letter were it go's so like that they don't have trouble looking for the person's letter

please mark me as brainlist

3 0
3 years ago
Read 2 more answers
Dr. Joon asks her students how to insert a table in an Excel workbook. The students record the steps a chart. Which students lis
Leona [35]

Answer:

C

Explanation:

Both Table and Format as Table can be used to create a table

4 0
3 years ago
A laptop computer communicates with a router wirelessly, by means of radio signals. the router is connected by cable directly to
Hoochie [10]
The answer would be 2500 Bits
4 0
3 years ago
Write a program that creates a dictionary containing the U.S. states as keys and their abbreviations as values. The program shou
AleksandrR [38]

Answer:

Explanation:

The following program is written in Python. It creates a loop that keeps creating a random number to randomly choose a State abbreviation from the dictionary. Then it asks the user what the state is. If the user gets the answer correct it prints out "Correct" and adds 1 point to the correct variables. Otherwise it prints "Incorrect" and adds 1 point to the incorrect variable. Finally, printing out the final amount of correct and incorrect responses. The program was tested and the output can be seen below.

import random

states = {"AL":"Alabama","AK":"Alaska","AZ":"Arizona","AR":"Arkansas","CA":"California","CO":"Colorado","CT":"Connecticut","DE":"Delaware","FL":"Florida","GA":"Georgia","HI":"Hawaii","ID":"Idaho","IL":"Illinois","IN":"Indiana","IA":"Iowa","KS":"Kansas","KY":"Kentucky","LA":"Louisiana","ME":"Maine","MD":"Maryland","MA":"Massachusetts","MI":"Michigan","MN":"Minnesota","MS":"Mississippi","MO":"Missouri","MT":"Montana","NE":"Nebraska","NV":"Nevada","NH":"New Hampshire","NJ":"New Jersey","NM":"New Mexico","NY":"New York","NC":"North Carolina","ND":"North Dakota","OH":"Ohio","OK":"Oklahoma","OR":"Oregon","PA":"Pennsylvania","RI":"Rhode Island","SC":"South Carolina","SD":"South Dakota","TN":"Tennessee","TX":"Texas","UT":"Utah","VT":"Vermont","VA":"Virginia","WA":"Washington","WV":"West Virginia","WI":"Wisconsin","WY":"Wyoming"}

keys_list = list(states)

correct = 0

incorrect = 0

while True:

   randNum = random.randint(0, 49)

   abbr = keys_list[randNum]

   answer = input("Enter The State name of " + abbr + ": ")

   if answer.lower() == states[abbr].lower():

       print("Correct")

       correct += 1

   else:

       print("Incorrect")

       incorrect += 1

   again = input("Play again? y/n ")

   if again.lower() == 'n':

       break

print("Correct: " + str(correct))

print("Incorrect: " + str(incorrect))

6 0
2 years ago
Other questions:
  • What do radio telescopes use to gather and focus radio waves?
    14·2 answers
  • What is the different between image processing and machine vision? Please explain with an example.
    11·1 answer
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • What provides quality education for students
    14·1 answer
  • Search..
    14·1 answer
  • Write a function template that accepts an argument and returns its absolute value. The absolute value of a number is its value w
    11·1 answer
  • Overview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for
    7·1 answer
  • SINCE I CANT SEE IT KANG LOOK
    6·2 answers
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. please select the
    9·1 answer
  • The iso 14001:2004 standards require documentation of a firm's environmental program. Which component requires a plan to improve
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!