• Why my program behaves differently

Question related to mission The Most Wanted Letter

 

When I execute my codes in Spyder , the answer is right.However , the result in checkio is not the same.