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
Nadusha1986 [10]
3 years ago
12

In this problem, you will fill in the code for a function count_digits(val) that takes a positive integer, val, and returns a li

st containing the count of the number of times that each digit 0 - 9 appears in val. Type the provided code into IDLE (or whatever Python IDE you are using). You will fill in the code where specified in the count_digits function. The function contains the line of code count_lst
Computers and Technology
1 answer:
mars1129 [50]3 years ago
7 0

Answer:

def count_digits(val):

   count_lst = [0] * 10

   val = str(val)

   for digit in val:

       if digit == "0":

         count_lst[0] += 1

       elif digit == "1":

         count_lst[1] += 1

       elif digit == "2":

         count_lst[2] += 1

       elif digit == "3":

         count_lst[3] += 1

       elif digit == "4":

         count_lst[4] += 1

       elif digit == "5":

         count_lst[5] += 1

       elif digit == "6":

         count_lst[6] += 1

       elif digit == "7":

         count_lst[7] += 1

       elif digit == "8":

         count_lst[8] += 1

       elif digit == "9":

         count_lst[9] += 1

   return count_lst

Explanation:

Create a function called count_digits that takes one integer parameter, val

Initialize a count_list that will hold the counts for the digits in the val

Convert val to string

Initialize a for loop that iterates through the val

Inside the loop, check each digit in val and increment its corresponding position in the count_list

When the loop is done, return the count_list

You might be interested in
Which internet explorer security feature restricts the browsing session information that can be tracked by external third-party
Anarel [89]

Tracking protection internet explorer security feature restricts the browsing session information that can be tracked by external third-party websites and applications

The internet can be a dangerous place, and it's important to take steps to protect your privacy. One way to do this is to enable tracking protection in your web browser.

Tracking protection is a security feature that restricts the information that can be tracked by external websites and applications. This means that your browsing session will be more private, and your data will be less likely to be collected and used without your consent.

To enable tracking protection in Internet Explorer, go to the Tools menu and select Internet Options. On the Privacy tab, click the Tracking Protection button. You can then choose to enable tracking protection for all websites, or only for certain websites that you trust.

Enabling tracking protection can help to keep your data safe and your privacy protected. So if you're concerned about online privacy, be sure to enable this feature in your web browser.

Learn more on internet explorer here:

brainly.com/question/28431103

#SPJ4

6 0
2 years ago
How do headphones work? (From pc)
____ [38]
<span>Large headphones are essentially just two loudspeakers mounted on a strap that clamps firmly over your head. Earbuds work the same way but, as you would expect, everything inside them (the magnet, the coil of wire, and the diaphragm cone that makes sound) is shrunk down to a much smaller size.</span>
5 0
3 years ago
The members of the IT department have spent two days debating the best approach to roll out the new software update. After allow
devlian [24]

Answer:

<em>Functional conflict</em>

Explanation:

Functional conflict means<em> encouraging workers to communicate different points of view and address disagreements in a healthy manner that can promote new ideas and new innovations.</em>

This compares with the unstable type of conflict that has no business advantage and only hurts the morale of interaction, productivity and workplace.

4 0
3 years ago
the mail merge feature can be used to address the same letter to several different people , true or false
sergij07 [2.7K]
The answer is that it is true.
4 0
3 years ago
Read 2 more answers
The World Wide Web Consortium enforced a stricter set of standards in a different version of Hypertext Markup Language (HTML) ca
Eva8 [605]

Answer:

Option B is the correct answer for the above question

Explanation:

XHTML is an advanced version of HTML language which is recommended by W3C. It set the standard in 26-JAN-2000 for the XHTML which belongs to the family of HTML. XHTML is made with the help of XML and also used like XML. It used to create more secure websites.

The Above question asked about the W3C recommendation but the above paragraph described that XHTML is a W3C recommendation. Hence Option B is the correct choice answer. while the other is not because--

  • Option A suggests HTML 4.01 which is the updated version of HTML only.
  • Option C suggests XML which is used to data transfer only.
  • Option D suggests about DHTML but XHTML is a W3C recommendation
5 0
3 years ago
Other questions:
  • Which graphic design tool allows you to lay images on top of one another? A. Layers B. Selection C. Drawing D. Color
    10·2 answers
  • What were the first microblogs known as
    12·2 answers
  • Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their
    14·1 answer
  • During the charging of a storage battery, what is the temperature that the electrolyte solution must never exceed?
    6·1 answer
  • What happens if the user sysadmin invokes the mail command interface and there are no unread mail messages?
    13·1 answer
  • Explain the difference between social engineering and reverse social engineering.
    6·1 answer
  • Which statement best describes desktop publishing?
    10·1 answer
  • Write the correct statements for the above logic and syntax errors in program below.
    12·1 answer
  • What does good time management mean​
    8·2 answers
  • Assignment 1:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!