Computer Science, asked by samomi, 5 months ago

Write a Python program to find the frequency of elements in a list using a

dictionary.

Answers

Answered by sanjana4320
0

Answer

PROGRAM:

  1. PROGRAM:#Initialize array.
  2. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];
  3. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.
  4. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);
  5. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;
  6. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):
  7. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):count = 1;
  8. PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):count = 1;for j in range(i+1, len(arr)):
Answered by vinay2461
0

Answer:

PROGRAM:#Initialize array.

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):count = 1;

PROGRAM:#Initialize array.arr = [1, 2, 8, 3, 2, 2, 2, 5, 1];#Array fr will store frequencies of element.fr = [None] * len(arr);visited = -1;for i in range(0, len(arr)):count = 1;for j in range(i+1, len(arr)):

Explanation:

Similar questions