List=[1,2,2,3,4,5]
Using break or continue condition find frequency of each element in List without using any other functions like append, count or dictionaries.
List = [1,2,2,3,4,5] for i in range(len(List)): freq = 0 for j in range(len(List)): if List[i] in List[:i]: break if List[i] == List[j]: freq += 1 if freq > 0: print(List[i], freq)
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments