Kcom. Instructions: Create a Python solution to the following task. Ensure that the solution produces output in exactly the same format shown in the sample(s) below, including capitalization and whitespace. Task: Create a solution that accepts an input identifying the name of a CSV file, for example, "input1.csv". Each file contains two rows of comma-separated values. Import the built-in module csv and use its open() function and reader() method to create a dictionary of key:value pairs for each row of comma-separated values in the specified file. Output the file contents as two dictionaries. The solution output should be exactly as shown with the single quotes around each key:value pair WITHOUT any leading or extra spaces anywhere: {'key': 'value', 'key': 'value', 'key': 'value'} {'key': 'value', 'key': 'value', 'key': 'value'} Here is the exact answer: {'a': '100', 'b': '200', 'c': '300'} {'bananas': '1.85', 'steak': '19.99', 'cookies': '4.52
Kcom.
Instructions: Create a Python solution to the following task. Ensure that the solution produces output in exactly the same format shown in the sample(s) below, including capitalization and whitespace.
Task: Create a solution that accepts an input identifying the name of a CSV file, for example, "input1.csv".
Each file contains two rows of comma-separated values.
Import the built-in module csv and use its open() function and reader() method to create a dictionary of key:value pairs for each row of comma-separated values in the specified file.
Output the file contents as two dictionaries.
The solution output should be exactly as shown with the single quotes around each key:value pair WITHOUT any leading or extra spaces anywhere:
{'key': 'value', 'key': 'value', 'key': 'value'}
{'key': 'value', 'key': 'value', 'key': 'value'}
Here is the exact answer:
{'a': '100', 'b': '200', 'c': '300'}
{'bananas': '1.85', 'steak': '19.99', 'cookies': '4.52'}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images