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
Aleks04 [339]
3 years ago
12

Write a python program which prints the frequency of the numbers that were

Computers and Technology
1 answer:
REY [17]3 years ago
3 0

Answer:

The program is as follows:

my_list = []

inp = input()

while inp.lower() != "stop":

   my_list.append(int(inp))

   inp = input()

Dict_freq = {}

for i in my_list:

   if (i in Dict_freq):

       Dict_freq[i]+= 1

   else:

       Dict_freq[i] = 1

for key, value in Dict_freq.items():

   print (key,"-",value,"times")

Explanation:

This initializes a list of elements

my_list = []

This gets input for the first element

inp = input()

The following iteration is repeated until user inputs stop --- assume all user inputs are valid

while inp.lower() != "stop":

This appends the input to the list

   my_list.append(int(inp))

This gets another input from the user

   inp = input()

This creates an empty dictionary

Dict_freq = {}

This iterates through the list

for i in my_list:

This adds each element and the frequency to the list

<em>    if (i in Dict_freq): </em>

<em>        Dict_freq[i]+= 1 </em>

<em>    else: </em>

<em>        Dict_freq[i] = 1 </em>

Iterate through the dictionary

for key, value in Dict_freq.items():

Print the dictionary elements and the frequency

   print (key,"-",value,"times")

You might be interested in
Setting the isShowing property to false of the opacity property to o will delete an object from an Alice world.
Tema [17]
I think true I’m not for sure
5 0
3 years ago
Read 2 more answers
The minimum spanning tree of an undirected graph G exists if and only if G is connected. True or False?
zlopas [31]

Answer: True

Explanation:

The definition of minimum spanning tree(MST) says that the graph must be connected and undirected to be considered for MST. It has (V-1) edges where V is the number of vertices. The minimum spanning tree is implemented using Kruskal's algorithm whereby it starts by considering the minimum weighted edge and covers all the edges upto (V-1) edges. So for MST it has to be connected

3 0
3 years ago
If you have two tasks x and y, with y being a successor to x, if we mark x as undone (because it needs to be redone for some rea
Ierofanga [76]

Answer:

idk

Explanation:

sorry

7 0
3 years ago
What is a quasi vpn?
Natasha2012 [34]

Answer:

i don't think there is such thing as a quasi vpn

Explanation:

6 0
3 years ago
Under Juran's Law, whenever a problem occurs, what percentage of the time is the problem the result of a system/process error?
quester [9]

Answer:

C. 85 percent

Explanation:

Juran's Law is a law used in the category of Total Quality Management. This law states that whenever a problem occurs during a process, only about 15% of the time is it the individual's fault, the rest of the time it is the process's fault. Therefore 85% of the time, the problem is the result of a system/process error.

7 0
3 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • What category of sensory receptors are sensitive to touch sound and motion?
    10·1 answer
  • General equation: y = (89 / 27) - z * x + a / (a % 2) (recall: a is an integer; the 89 and 27 constants in the equation should b
    14·1 answer
  • When you open as many links as you want, and still stay in the same browser window instead of cluttering your screen with multip
    5·1 answer
  • Select what's true about Search Engine Companies. Check All That Apply The information contained in a search engine database is
    12·1 answer
  • Ayuda no encuentro la información de estas tres preguntas:
    10·1 answer
  • What is the missing line of code?
    10·2 answers
  • Which cable standard is a standard for newer digital cable, satellite, and cable modem connections?
    11·1 answer
  • Which of the following best describes contextual design?
    10·1 answer
  • Red + blue =<br>Red + green =<br>Magenta - blue =<br>Yellow - green =<br>Cyan - blue =​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!