with negative number implies counting indices from the end of the list)and extending the list representation to handle negative powers is not trivial task examplereading file data to dictionary say we have file deg txtcontaining temperature data for number of citiesoslolondonberlinparisromehelsinki we now want to read this file and store the information in dictionarywith the city names as keys and the temperatures as values the recipe is nearly identical to the one we previously used to read file data into listsfirst create an empty dictionary and then fill it with values read from the filewith open('deg txt'' 'as infiletemps {start with empty dict for line in infilecitytemp line split(city city[:- remove last char (:temps[cityfloat(tempthe only real difference between this code and previous examples based on lists is the way new data are added to the dictionary we used the append method to populate an empty listbut dictionaries have no such method insteadwe add new key-value pair with the line temps[cityfloat(tempapart from this technical differencethe recipe for populating dictionary is exactly the same as for lists string manipulation we have already worked with strings (having type str)in previous for instance introducing the very useful split-methods 'this is strings split(['this''is'' ''string'string manipulation is essential for reading and interpreting the content of filesand the way we process files often depends on the file structure for