working with dictionaries and writing and reading text files