Skip to content Skip to sidebar Skip to footer

Can You Help Me Fix Code To Show The Occurrence Of Items In A List, For Only The First Five Items?

I created this file as part of homework for a class and already got 100%. However, the instructor had originally wanted to also show frequencies for only the first 5 items in each

Solution 1:

I think I get your question now and think that your code needs only a minor change:

When you are appending list to your returning list (winninglist), slice the last index of the appending list.

Do the following:

change

winninglist+=item

to

winninglist+=item[0:len(item)-1]

Post a Comment for "Can You Help Me Fix Code To Show The Occurrence Of Items In A List, For Only The First Five Items?"