I have a list of NBA teams:
teams = ("Los Angeles Clippers","Dallas Mavericks","New York Knicks","Atlanta Hawks")
And the results of some matches:
results = ("Los Angeles Clippers 104 Dallas Mavericks 88,New York Knicks 101 Atlanta Hawks 112")
There are many more names and matches, but for the question I have picked a few.
My question is: how can I split the results scores so that the NBA team names are keys and the scores are values? (I am not looking for code as a solution- just an explanation/description)
Here are my thoughts so far, I know how to add the NBA names as keys in the dictionary, but I am struggling with finding a method to assign the numbers to each team in coding terms. I have got as far as using split() and splitting results at every coma.
I am thinking of then splitting it further, but even if I split each shortened string by name, how can I assign their values next to each of them?