Answer to Question #298915 in Python for Michael

Question #298915

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.

1
Expert's answer
2022-02-18T07:31:39-0500
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?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS