I have a dataset of names and activities. This data is in one long string format. The data is divided into multiple lines (separated by line break "\n"). Each line has a name and an activity separated by a colon. The last line does not have the line break.
Example: "Jack:travel\nPeter:cycling\nJack:fishing\nPeter:running"
The goal is to create a dictionary from this string, but if names are duplicates, then add activities together into a list after this name:
In the current example the output should be:
{"Jack": ["travel", "fishing"], "Peter": ["cycling", "running"]}
How can I do that?