def sum_city_pop(): '''sum the populations of cities stored in a text file''' file = open('population.txt') # total population totalpop = 0 for line in file: line = line.strip() fields = line.split() cityname = fields[0] # unused here citypop = fields[1] # the field we want totalpop += int(citypop) print('Total population is', totalpop) file.close() def remove_list_duplicates(some_list): '''returns a new list that has all the duplicates removed''' return list(set(some_list))