I'm confused on lists | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm confused on lists

i don't understand how you find out how many times a number repeats in a list. please help.

7th Mar 2017, 7:54 PM
Lulazy
Lulazy - avatar
1 Answer
0
I will try not to give you the classical algorithm, but rather an outline, so you can code it yourself. How do you count the number of occurrences in a list ? You go through all the list and if the item you are looking at is identical or (just) equal to the one you want, increment the count. That's it. Have a go
7th Mar 2017, 9:16 PM
Amaras A
Amaras A - avatar