Program Tasks: Write a program displayClimate.py that performs the following functionalities: a. reads the JSON file climate.json b. displays the cities as a list. c. prompts the user to enter a city or cities. d. searches for the relevant data and display(s): (i) the average rainfall for each month as a list. (ii) minimum and maximum rainfall per year. (iii) the average rainfall per year. e. The use of at least three functions (not including the main function) must be implemented in creating this program.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Note:  I have the JSON file. Please let me know the code for the rest of the program or else let me know how to upload the file here so that you can help me accurately but please don't reject. this is very important to me .

The JSON file provided, climate.json, contains monthly climate data of over one-hundred destinations and
includes average high and low temperature, dry days, snow days, and rainfall, for every month.
Program Tasks:
Write a program displayClimate.py that performs the following functionalities:
a. reads the JSON file climate.json
b. displays the cities as a list.
c. prompts the user to enter a city or cities.
d. searches for the relevant data and display(s):
(i) the average rainfall for each month as a list.
(ii) minimum and maximum rainfall per year.
(iii) the average rainfall per year.
e. The use of at least three functions (not including the main function) must be implemented in creating this program. 

Structure of the climate JSON file:
• JSON data works just like python dictionary and you can access the value using dictionaryName[key].
• The JSON file contains a list of 104 dictionary items and each dictionary item has 4 keys.
• The monthlyAvg key has a list as its value, which in return contains 12 dictionary items representing each month in a year.
• You may use the website https://codebeautify.org/jsonviewer and load the file into its editor. The website will display structure and details of this JSON file. Alternatively, you can view this file using any text editor.
• A snapshot of the structure of this file is shown below. 

Structure of climate.json file:
[
{
"id": 1,
"city": "Amsterdam",
"country": "Netherlands",
"monthlyAvg": [
{
"high": 7,
"low": 3,
"dryDays": 19,
"snowDays": 4,
"rainfall": 68
},
{
"high": 6,
"low": 3,
"dryDays": 13,
"snowDays": 2,
"rainfall": 47
},

]
},
{
"id": 2,
"city": "Athens",
"country": "Greece",
"monthlyAvg": [
{
"high": 12,
"low": 7,
"dryDays": 21,
"snowDays": 1,
"rainfall": 53
},

]
},

]

Loading a JSON file:
with open('climate.json', 'r') as f:
# convert a json object into a readable python object
data = json.load(f)
Requirements that MUST be fulfilled : 
a. Readability of your code and proper code documentation.
b. Use of user defined functions

Output :  After user input 

Enter 0 to terminate input.

Enter City to check rain fall data: Vancouver

Enter City to check rainfall data: Calgary

Enter city to check rain fall data: 0

Average monthly rain fall in mm for Vancouver:[232,122.8,154,116.4,91.7,79,41.2,54.2,67.8,158.9,250.8,208.5]

Min : 41.2 mm

Max: 250.8 mm

Average 131.44 mm

Average monthly rain fall in mm for Calgary: [11.4,10.5,17.1,28.9,60.6,113.3,59.3,58.6,35.9,17,15.8,11.2]

Min: 10.5 mm

Max: 113.3 mm

Average: 36.3 mm

Would you like to continue? press Y or N:

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education