dictionaries and strings return sum we see that the function follows our standard recipe for evaluating sumset summation variable to zero and then add in all the terms using for loop we can write an even shorter version of the function using python' built-in function sumdef eval_poly_dict(polyx)python' sum can add elements of an iterator return sum(poly[power]* **power for power in polysince the keys of the polynomial dictionary are integerswe can also replace the dictionary with listwhere the list index corresponds to the power of the respective term the polynomial abovethat is- can be represented as the list [- and the general polynomial = ci is stored as [ cnthe function to evaluate polynomial represented by list is nearly identical to the function for the dictionary the function def eval_poly_list(polyx)sum for power in range(len(poly))sum +poly[power]* **power return sum will evaluate polynomial = ci for given an alternative and arguably more "pythonic versionuses the convenient enumerate functiondef eval_poly_list_enum(polyx)sum for powercoeff in enumerate(poly)sum +coeff* **power return sum the enumerate function essentially turns list into list of -tupleswhere the first element is the index of list element and the second is the element itself the function is quite convenient for iterating through list when we also need access to the indicesand it is very common in python programs the representations based on dictionaries and lists are very similarbut the list representation has the obvious disadvantage that we need to store all the zeros for "sparsehigh-order polynomialsthis can be quite inconvenientand the dictionary representation is obviously better the dictionary representation can also easily handle negative powersfor instance - {- print eval_poly_dict(px= this code will work just fine without any modifications of the eval_poly_dict function lists in python cannot have negative indices (since indexing list