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]
2 years ago
12

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

Computers and Technology
1 answer:
REY [17]2 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
What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign key
aev [14]

Answer:

A. To uniquely identify each record in the table

brainliest pls?

6 0
2 years ago
Your sister wants to purchase Microsoft Office 2013 for her new laptop. She doesn't want to pay for a subscription, and she want
Pavel [41]

I would buy Microsoft Office 2013 Home and Business Pc License. Its better to purchase the product in all rather than a subscription.

5 0
3 years ago
What is the name of the file manager in microsoft windows?
Ivan
It is called Windows Explorer referred as explorer.exe<span />
7 0
3 years ago
Read 2 more answers
Bank of America sends out customer surveys to all of its customers asking them about the services they offer. What type of resea
ValentinkaMS [17]

Answer:

<u>Market research</u>

Explanation:

<u>Market research:</u> The term "market research" is described as a process of describing the viability of a new product or service via specific research that is being conducted directly with the different potential customers. Therefore, market research allows a specific company to discover or identify the target market and receive opinions and some other feedback from various consumers regarding their interest associated with the service or the product.

<u>In the question above, the given statement represents market research.</u>

4 0
3 years ago
What service converts ip addresses into more recognizable alphanumeric names??
tresset_1 [31]
I think is DNS..........
6 0
3 years ago
Other questions:
  • Computer programmers often use binary codes (strings of 1s and 0s) to write programs for computers. These codes are then changed
    6·1 answer
  • If you cause a car accident, which type of insurance will require you to pay the least out of pocket?
    5·2 answers
  • Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and
    5·1 answer
  • Write a Unix (Linux) find-like command (myFind) in Python3 where the function will return the full paths of all the files contai
    9·1 answer
  • Listed here are a few camera angles and their images.
    10·1 answer
  • I created a brainly account and forgot everything I mean everything so I cannot log back on and my debit Card is currently about
    11·2 answers
  • How are actual rocket launches similar to how balloon rockets and canister rockets launch?
    6·1 answer
  • Hey does anyone know the name of that movie where like this teenage girl is chilling at her house then there is an outbreak of s
    6·1 answer
  • Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho
    5·1 answer
  • Write a statement that slices a substring out of the string quote and puts it into a variable named selection. If given the stri
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!