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")