Dark theme

Hints


The code you'll need includes:
position = some_string.find("substring", start_position_for_search, end_position_for_search)
Use this to find the position of ":" and then, having found this, the find the space between the two name parts and after the numerical part. This should give you the position of the start of the two parts, and the end of the last one.

Using these positions, you should then be able to use slices to extract the words to variables, for example:
first = text[first_position : second_position]
and build the dictionary.

Although once you've got the idea of using find there's little other code needed, this is quite a tricky task. The reason is you have to understand what positions find is returning. You'll need to print out some stuff in order to work this out. Build up the algorithm a line at a time, starting by finding the ":" and printing its position. The idea with this task is it will get you used to not worrying when things don't work, but rather printing the results to work out why they don't work.


One answer