Hello! I have a problem using the list. The task is to find out how many times each word in the list appears in the list. The words are consecutive, that is, for example, an apple appears in the list three times in a row. How do I get an analysis in which two empty lists store the name in one and the number in the other?
How to use list to solve things
How to use list to solve things
|
Nov-13-2021, 07:18 PM
(This post was last modified: Nov-13-2021, 07:18 PM by Gribouillis.)
Please post your python code and any error message. We'll be happy to help if it doesn't work as you expect.
Nov-13-2021, 07:21 PM
The problem is that i don't know how to even get started..
Nov-13-2021, 07:28 PM
Try working out the steps you would take to do it yourself not using python.
Nov-14-2021, 12:57 PM
So something like
Start at the beginning of list, note the first word, call it active. Move to the next word. If the same, increment a counter, otherwise call that count final and make this word the new active. When you reach the end of the list, print out the list of words and counts. Does that sound like what you want to do? If so, take each step and program that step. Once that is working move to the next step. |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
So many things wrong, it runs but not like its supposed to | kasherwood | 6 | 2,756 |
Sep-26-2020, 04:57 PM Last Post: deanhystad |
Users browsing this thread: 1 Guest(s)