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
The systems development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems t
MissTica

Answer:

the system development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems through a multistep process—initiation, analysis, design, implementation, and <u>maintenance to disposal.</u>

Explanation:

There are several  SDLC models and each generally consists of a numbers of definite stages. For a given adopted SDLC model, information security and product services must be integrated in to the SDLC to ensure appropriate protection for the information that the system will transmit, process, and store.

8 0
3 years ago
If I want to make it look like slide number one is turning a page to slide number two, what
garik1379 [7]

Answer:

Im not certain but I think thwir is one called flip

Explanation:

Kind of works like a book if thats what your asking for

6 0
2 years ago
Xercise 1<br>1.<br>What is system? Explain the components of system in brief.​
noname [10]

Answer:

A system is a collection of elements or components that are organized for a common purpose. ... A computer system consists of hardware components that have been carefully chosen so that they work well together and software components or programs that run in the computer.

Explanation:

4 0
3 years ago
Mr. O would like to purchase a new computer for his home business. Mr. O's current computer runs very slow when he is running e-
NISA [10]

Answer:

Processor

Explanation:

The processor handles large amounts of logical information (not storage or graphical), since this is what he is struggling with he likely needs a better CPU.

4 0
3 years ago
Read 2 more answers
File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then
myrzilka [38]

Answer:

import java.util.Scanner;

public class Sales

{

public static void main(String[] args) {

   

    int sum;

    Scanner input = new Scanner(System.in);

   

    System.out.print("Enter number of salespeople: ");

    int salespeople = input.nextInt();

    int[] sales = new int[salespeople];

       

    for (int i=0; i<sales.length; i++)

    {

     System.out.print("Enter sales for salesperson " + (i+1) + ": ");

     sales[i] = input.nextInt();

    }

    System.out.println("\nSalesperson   Sales");

    System.out.println("--------------------");

    sum = 0;

       int maxSale = sales[0];

       int minSale  = sales[0];

       int minId=1;

       int maxId=1;

    for (int i=0; i<sales.length; i++)

    {

               System.out.println("     " + (i+1) + "         " + sales[i]);

 sum += sales[i];

  if(maxSale < sales[i])

           {

               maxSale = sales[i];

               maxId = i+1;

           }

           if(minSale > sales[i])

           {

               minSale = sales[i];

               minId = i+1;

           }

   }

System.out.println("Total sales: " + sum);

       System.out.println("The average sale is: " + sum / salespeople );

       System.out.println("Salesperson "+ maxId + " had the highest sale with "+ maxSale + ".");

       System.out.println("Salesperson "+ minId + " had the lowest sale with "+ minSale + ".");

       

       int amount = 0;

       int counter = 0;

       System.out.print("Enter an amount: ");

       amount = input.nextInt();

       for (int i=0; i<sales.length; i++)

    {

     if(sales[i] > amount) {

         counter++;

         System.out.println("Salesperson "+ (i+1) + " exceeded given amount. (Number of sales: " + sales[i] +")");

     }

    }

       System.out.println("Number of salespeople exceeded given amount is: "+ counter);

}

}

Explanation:

- Ask the user for the number of salesperson

- According to entered number, create an array called sales to hold sale number for each person

- In the first for loop, assign the given sales numbers

-  In the second for loop, print all the sales people with sales, calculate the total sales. Also, find the minimum and maximum sales numbers with associated individuals.

- Print total, average, highest, and lowest sales.

- Ask user enter an amount

- In the third for loop, find the sales people who exceeded this amount.

- Print number of sales people who exceeded the amount.

8 0
3 years ago
Other questions:
  • What do you call the combination of title, description, tags, and thumbnail?
    6·1 answer
  • In Java Write a program that prompts the user for a name (any String value would work for testing), and print a hello message to
    15·1 answer
  • Implement the function:
    6·1 answer
  • Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar co
    10·1 answer
  • You have a web application hosted in AWS cloud where the application logs are sent to Amazon CloudWatch. Lately, the web applica
    7·1 answer
  • What type of version of visual studio is the visual studio express
    8·1 answer
  • Sally has 4 quarters, 2 dimes, 6 nickels, and 10 pennies.
    13·2 answers
  • Taylor and Rory are hosting a party. They sent out invitations, and each one collected responses into dictionaries, with names o
    9·1 answer
  • PLS ANSWER ASAP!!!! <br><br> In three to five sentences, explain the function of utilities.
    13·1 answer
  • What starts with p and ends with orn
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!