Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / It is a python assignment working with a json file Final Assignment – COMP 1110 (Fall 2020)                                                                                     (Total: 30 points)   Introduction:   In this final assignment you are asked to write a python program that extracts monthly rainfall for different cities from a JSON file

It is a python assignment working with a json file Final Assignment – COMP 1110 (Fall 2020)                                                                                     (Total: 30 points)   Introduction:   In this final assignment you are asked to write a python program that extracts monthly rainfall for different cities from a JSON file

Computer Science

It is a python assignment working with a json file

Final Assignment – COMP 1110 (Fall 2020)                                                                                     (Total: 30 points)

 

Introduction:

 

In this final assignment you are asked to write a python program that extracts monthly rainfall for different cities from a JSON file.

 

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:

 

  1. reads the JSON file climate.json

 

  1. displays the cities as a list.

 

  1. prompts the user to enter a city or cities.

 

  1. searches for the relevant data and display(s):

 

    1. the average rainfall for each month as a list.

 

    1. minimum and maximum rainfall per year.

 

    1. the average rainfall per year. 

 

  1. The use of at least three functions (not including the main function) must be implemented in creating this assignment, as well as basic error checking.  Submissions without appropriate functions and basic error checking in place would automatically be not graded and a zero-mark credited.  Using only main() function is also not acceptable as having written an appropriate function in your program code, hence your assignment would automatically be not graded and a zero-mark credited.

 

Brief introduction to the JSON file

 

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 on the following page. 

 

 

 

 

 

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 to receive credit for this assignment:

 

  1. Readability of your code and proper code documentation. 

 

  1. Use of user defined functions.  

 

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

      },       …

    ]

  },

  …

]  Sample Output: 

(Before clicking on the list)

 

 

 

(After clicking on the list)

 

 

 

(After clicking “Expand in Shell” button)

 

 

 

             

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After user input

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Criteria’s to follow in fulfilling the final assignment.  Failure to comply will result in a zero mark.

 

  • Name your file: displayClimate.py o Appropriate header comments that includes the following as listed below in the same order:

 

  • Your Actual Name: LastName_FirstName (This is your own Last Name and First Name – Please do not convert your actual Last Name and First Name to be LastName_FirstName.
  • Course Name: COMP1110 o Final Assignment o Today’s Date:
  • Brief description of program code:

 

  • Comments throughout program code.  o Implementing at least three functions, not including the main function.
  • Logical approach to problem solving, computation, and displaying appropriate output EXACTLY as per sample runs shown in screen shots.
  • File, functions, and screen shots (same name as your program file: i.e. displayClimate.py) named appropriately.
  • Do NOT use any special formatting in your print statement.   o Do NOT use __main__ anywhere in your program code.
  • Upload your python file and image files separately of test cases as shown in the sample runs.  DO NOT zip your files into a folder.
  • Draft, late, email or wrong file submission

Option 1

Low Cost Option
Download this past answer in few clicks

70 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions