text = input("Enter score to reach next week: ") value = int(text) info['goal'] = value print("Updated dictionary") print("info = ", info) text = info['score'] score = int(text) text = info['goal'] score_goal = int(text) difference = score_goal - score print("That's", difference, "points more.")
Look what happened to the key-value pairs. The MicroPython runtime interpreter changed the order when you added the goal': 2000 pair. Again, that change in order did not matter because the script used the 'score' and 'goal' keys to look up the values that got stored in the score and score_goal variables. Then, the script used these values to correctly calculate:
difference = score_goal - score
= 2000 - 1234
= 766.