The vet's notes have one pet per line: a name and a weight (whole kilos), with one space between. Write read_weights(text) to make a {name: weight} dict, with the weights as numbers. If a pet was weighed twice, keep the later one.
read_weights("Momo 4\nRex 12")→{'Momo': 4, 'Rex': 12}read_weights("")→{}def read_weights(text):
weights = {}
for line in text.splitlines():
name, kg = line.split()
# your code here: turn the weight into a number and store it in the dict
return weights
Run tries the examples. When they look right, Submit.