Question
redjson1.json file { 2018-01-01T00:00:00-05:00: { visibility: { prevailing: 1.75, units: SM }, wind: { speed: 13.0, crosswind: 5.0, units: KT }, temperature: { value: -15.0,
redjson1.json file
{
"2018-01-01T00:00:00-05:00": {
"visibility": {
"prevailing": 1.75,
"units": "SM"
},
"wind": {
"speed": 13.0,
"crosswind": 5.0,
"units": "KT"
},
"temperature": {
"value": -15.0,
"units": "C"
},
"sky": [
{
"cover": "clouds",
"type": "broken",
"height": 1200.0,
"units": "FT"
},
{
"type": "overcast",
"height": 1800.0,
"units": "FT"
}
],
"weather": [
"light snow",
"mist"
],
"code": "201801010456Z"
},
"2017-12-31T23:00:00-05:00": {
"visibility": {
"prevailing": 1.75,
"units": "SM"
},
"wind": {
"speed": 13.0,
"crosswind": 5.0,
"units": "KT"
},
"temperature": {
"value": -15.0,
"units": "C"
},
"sky": [
{
"cover": "clouds",
"type": "broken",
"height": 1300.0,
"units": "FT"
},
{
"type": "overcast",
"height": 2200.0,
"units": "FT"
}
],
"weather": [
"light snow",
"mist"
],
"code": "201801010356Z"
},
"2017-12-31T22:00:00-05:00": {
"visibility": {
"prevailing": 3.0,
"units": "SM"
},
"wind": {
"speed": 11.0,
"crosswind": 7.0,
"units": "KT"
},
"temperature": {
"value": -15.0,
"units": "C"
},
"sky": [
{
"type": "overcast",
"height": 1300.0,
"units": "FT"
}
],
"weather": [
"light snow",
"mist"
],
"code": "201801010317Z"
},
"2017-12-31T21:00:00-05:00": {
"visibility": {
"prevailing": 10.0,
"units": "SM"
},
"wind": {
"speed": 10.0,
"crosswind": 7.0,
"units": "KT"
},
"temperature": {
"value": -16.1,
"units": "C"
},
"sky": [
{
"type": "overcast",
"height": 1700.0,
"units": "FT"
}
],
"code": "201801010156Z"
}
}
redjson2.json file
[
{
"cover": "clouds",
"type": "broken",
"height": 1200.0,
"units": "FT"
},
{
"type": "overcast",
"height": 1800.0,
"units": "FT"
}
]
Could you help me implement this function, please? (see attachment)... Could you help me implement this function, please? (see attachment) def write_json(data,filename): Writes the given data out as a JSON file filename. To be a proper JSON file, data must be a a JSON valid type. That is, it must be one of the following: (1) a number (2) a boolean (3) a string (4) the value None (5) a list (6) a dictionary The contents of lists or dictionaries must be JSON valid type. When written, the JSON data should be nicely indented four spaces for readability. Parameter data: The Python value to encode as a JSON file Precondition: data is a JSON valid type Parameter filename: The file to read Precondition: filename is a string representing a path to a file with extension .json or .JSON. The file may or may not exist. #pass Project Filetree # Implement this function File Edit SUWIDUHAYE Working with Dat... Working with Data File (master) exercise1 exercise2 exercise3 exercise4 _pycache___ files funcs.py tests.py View Tools Education 14. Impleme... x samples settings Collapse E4: Reading & Writing JSON Files 14. Implement write_json Read the specification of the function write_json in the module funcs. Implement this function according to its specification. Note that a valid JSON data value could be many things, not just a dictionary. OO Check the Function You may run this test multiple times. Check It! When you have implemented the function, test your answer with the test script. You should now pass all tests. Q LAST RUN on 6/26/2021, 10:34:54 AM XFile 'funcs.py' has a major syntax error. Traceback (most recent call last): FileNotFoundError: [Errno 2] No such file or directory: 'json1.json' Next
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started