0
Why does this loop not move past the 1st segment of the list? I want it to tell me how many times each number is in the list.
Numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 2] numb = 0 num = Numbers[numb] Total = Numbers.count(num) while numb < (len(Numbers)): print("The Number", (num), "Occurs", total, "Times") numb = numb + 1
3 Réponses
+ 1
You are incrementing numb inside while loop ,so numb will always be 0
0
Can you advise where this should be? Thanks
0
Try keeping num and Total Inside while loop ,maybe that will work