Question: def store(d,filename): Given a dictionary d and a string filename, create a new file named filename and output the content of d into that file.

def store(d,filename): Given a dictionary d and a string filename, create a new file named filename and output the content of d into that file. You can assume that the dictionary d always has the key:value format as string:[list,of,integers]. Every key-value pair of the dictionary should be output as: a string that starts with key, followed by":", a tab, then the integers from the value list. Every integer should be followed by a"," and a tab except for the very last one, which should be followed by a newline. their keys. See the example below * Assumptions: (1) if a file named filename already exists, then the content should be overwritten; (2) dictionary d could be empty (3) the value list could be empty; and (4) the function returns None o out.txt apple: orange: 1,3 Examples o d orange': [1,3], apple [2]) o store(d, "out.txt" should end up with a file to the right # the file contents should be read as this string: # "apple:\t2inorange :\t1, t3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
