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
crimeas [40]
3 years ago
12

Take a list of numbers that range in value from 0 to 9 and output how many occurrences of each number exist.

Computers and Technology
1 answer:
mel-nik [20]3 years ago
4 0

Answer:

The program in Python is as follows:

def count_occur(myList):

   freq = {}

   for item in myList:

       if item in freq:

           freq[item] += 1

       else:

           freq[item] = 1

       

   for item in freq:

       print(item," ",freq[item])

Explanation:

This gets the list from the main

def count_occur(myList):

This initializes an empty dictionary

   freq = {}

This iterates through the list and count the occurrence of each item

<em>    for item in myList:</em>

<em>        if item in freq:</em>

<em>            freq[item] += 1</em>

<em>        else:</em>

<em>            freq[item] = 1</em>

This iterates through the dictionary

   for item in freq:

This prints each dictionary item and the frequency separated by -

       print(item," ",freq[item])

You might be interested in
__________ is a strategy of using multiple types of technology that prevent the failure of one system from compromising the secu
Anastaziya [24]

Answer:

<u>Redundancy</u> is a strategy of using multiple types of technology that prevent the failure of one system from compromising the security of information.

Explanation:

Redundancy means having extra or duplicate resources available to support the main system. It is a backup or reserve system that can step in if the primary system fails. The reserve resources are redundant most of the time as they are not being used if everything is working properly.

8 0
3 years ago
A list that is not sorted by numbers is called a?
Feliz [49]

Answer:

An unordered list(HTML)

6 0
4 years ago
A developer has the following class and trigger code:public class InsuranceRates {public static final Decimal smokerCharge = 0.0
deff fn [24]

Answer:

InsuranceRates.smokerCharge

Explanation:

To set the baseCost variable to the value of the class variable smokerCharge, the developer needs to replace

Decimal baseCost = XXX;

with

Decimal baseCost = InsuranceRates.smokerCharge;

This is done using the class reference type.

The smokerCharge should be declared in the InsuranceRates class, at first.

For example Ball b;

And then, a new instance of the object from the class is created, using the new keyword along with the class name: b = new Ball();

In comparing to the example I gave in the previous paragraph, the object reference in the program is:

InsuranceRates rates = new InsuranceRates();

Because the smokerCharge is coming from a different class, it can only be assigned to the variable baseCost via the InsuranceRates class to give:

Decimal baseCost = InsuranceRates.smokerCharge;

4 0
4 years ago
Should students be able to use their phones during class
Allushta [10]
Hmm..This is a tough answer it all depends on how the students use their cell phones and if they can handle the privilege...And if they could "Sure why not" and you should monitor the students too
5 0
3 years ago
Using an outline, how do you maintain your computer or cellphone​
daser333 [38]

Answer:

  1. well first things first be good to your battery.
  2. get padded protection of your laptop.
  3. disable programs you don't use.

6 0
3 years ago
Other questions:
  • Have you ever tried to teach a class full of restless, active sixth-graders? I have. I taught sixth-grade students for 12 years.
    15·1 answer
  • Select the term being defined. This term is also called live, or hot, which means that a voltage is present and it can cause an
    12·2 answers
  • The keyboard preferences pane includes a list of keyboard shortcuts.
    8·1 answer
  • 4. How does distance affect the strength of the force of gravity?_
    5·1 answer
  • The person who suggested that the continents were once a supercontinent, called Pangaea, but slowly drifted apart was who
    10·2 answers
  • Ryan needs to see the space available to insert content on a slide in his presentation. Which feature of a presentation program
    10·1 answer
  • p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov
    12·1 answer
  • What are the ways to search out a number from a tree?
    11·1 answer
  • Hattie uses the line of code num == 7 to assign the number 7 to the variable named num. What correction should be made?
    7·1 answer
  • A user can view <br> and <br> in the Reading pane.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!